Issue solved
I have solved the issue. I wanted to initialize the destination viewController to be displayed from the source viewController (parent view controller) from prepareForSegue:. I had succeeded with this method (failed mathod) earlier, in Mac OS X Lion, XCode 4.2, iOS5 SDK. I debugged and confirmed that prepareForSegue: is called before viewDidLoad:. To solve, I added property (NSString) in destination viewController class, initialized property from prepareForSegue: and initialized UITextField control from viewDidLoad: using property value.
I am quoting excerpts from an article that mislead me:-
"The prepareForSegue method is invoked whenever a segue is about to take place. The new view controller has been loaded from the storyboard at this point but it’s not visible yet, and we can use this opportunity to send data to it. (You never call prepareForSegue yourself, it’s a message from UIKit to let you know that a segue has just been triggered.)"
Also, I wonder why this was working in OS X Lion (As I see this was the only difference earlier when the method I followed first, worked)?
|