I created ViewController in Storyboard and I am using
instantiateViewControllerWithIdentifier:
to load it. But I need to have this VC as base class and use 3-4 subclasses to change its properties.
How can I get an instance of my subclass with instantiateViewControllerWithIdentifier
?
@Bhagyesh version in Swift 3:
Just cast it.
or Swift:
You will have to use object c runtime. Override init method of your subclass. Create a BaseViewController object using 'instantiateViewControllerWithIdentifier'. Then set the class for created object using objc_setClass method. Following code will go into SubclassViewController.m.
After this, you can simply create SubclassViewController object using simple [[SubclassViewController alloc] init].