When I want to set an ID for a view controller, I go into the storyboard file, select View Controller , Then type something like "theVCID" in Inspector I Storyboard ID
on Identity:
When I want to use that view controller in code then I do something like this:
UIViewController * myVC = [MyStoryboard instantiateViewControllerWi ThIdentifier: @ "theVCID"];
Is there any way to hardcode this id string at a place instead of hard coding inside the storyboard and when I use it in the code?
If I get a variable in the Storyboard XML, I could get the hardcode string variable in the XML source, but I do not know how to set a variable so that the storyboard XML could access it.
The safest way to do this is to put your storyboard identifiers in a single class (say storyboard coordination controller) and simply reference storyboard objects through this single interface, hope you never get into such a situation Should be where these values are changing often, and if you definitely want to do something about it):
Comments
Post a Comment