开发者

ViewDidLoad not the right command

I can't seem to find what I am looking for in the Apple documentation. I am sa开发者_如何学Cving a simple string to an NSUserDefaults location and I want it to load that string into a UITextField in a view that I have already created. Everything is working great with the data persistence (it is saving and loading correctly) but it will only load the information on viewDidLoad. The user edits the field in a modal view so when I call dismissModalViewControllerAnimated, the view does not register the updated UITextField because viewDidLoad is not being called for the first time. (hope I am explaining this coherently enough - i apologize)

How can I have it update that UITextField immediately so the user can see their updated field? I don't think viewDidAppear is the correct place but I can't figure out where to put it.


How about -viewWillAppearAnimated:(BOOL)animated, instead of -viewDidLoad?


Or do it in the modal view before you dismiss it by calling the modal views parent (which should be the controller for the textField) and editing it there

In your Modal View Controller before you dismiss it:

self.parentViewController.myTextField.text = editingTextField.text;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜