Reputation: 3607
In short, I want to know "How to change Runtime User defined attributes before instantiating a View Controller"
Why I Need this
I am creating an application which uses multiple storyboards. I have a main storyboard with a UIViewController designated as LinkViewController. It has a string attribute, which tells it which storyboard has to be linked. now what I want to do is, I want to change that attribute at appDelegate & then instantiate the viewController. So far not able to do it.
This is what I am doing:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
EffLinkHomeVC *rootController = [storyboard instantiateViewControllerWithIdentifier:@"linkView"];
rootController.storyBoardName = @"wxyzForiPhone";
self.window.rootViewController = rootController;
I have found several other ways to work around. But I just want to know more clearly about altering "Runtime User defined attributes". Thank you all. :)
Upvotes: 1
Views: 319
Reputation: 1160
As far as I know you can only do this with proxy/external objects available in nibs. Check the answer here to see a nice example of their usage.
By the looks of it this functionality is hidden or removed from storyboards. The only documented ways of configuring are static. In your case it would be statically configured with the properties from the storyboard you are using. If this suffices, you could use the key value mechanism to statically configure a different value for each storyboard.
Other than that you only have the normal post init viewController methods.
Upvotes: 1