I am trying to see if this would be a good option? I am trying to generalize info button -> to one view controller with different views
My model looks like:
- ViewController
- View One
- View Two
- View Three
Now I am trying to set all these view in Case bases, based on where the info button is going to click on different view controller, that particular view is going to show with respect to the info view controller. In order to achieve this, I had an idea of connecting simply the outlet for the view controller on the run-time to the view I want to set.
Is there anyway to set the Outlet pro-grammatically at run-time?
Thanks
Short answer: Yes, you can set any property at runtime.
Longer answer: Yes, You can set any property (e.g.
@property (nonatomic, strong) UIView *myView) at runtime. An outlet is simply a property that is defined withIBOutletto allow interface builder to see it as an available outlet. If you are only going to assign the property at runtime you don’t need to define the property as IBOutlet. Not sure how you’ve architected your app so don’t know if you want to conditionally create a view controller or a view. In any case, at runtime, you set the property as you would any other property based on the condition you are checking.