DetailViewController Dumb Question [closed]
I'm working on an iPhone app that has a UITableView
with multiple entries and when you click on each, it takes you to the same view using a navigation controller. This is good, I want the same view every time, except for one of my entries I want to hide a text label. I have succeeded in doing this, except I did it in the viewDidAppear
method, so when I push the view from the side, it shows up for just a split second before it disappears. How do I fix this so that it never shows up?
Thanks,
VectorWare
That requirement calls for the viewWillAppear
method.
You can and should do all kinds of modifications to your view inside that method.
All modifications will be applied to the objects in the current view before it gets shown via the loadView
or viewDidLoad
methods.
From the docs: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html
viewWillAppear: Notifies the view controller that its view is about to be become visible.
- (void)viewWillAppear:(BOOL)animated Parameters animated If YES, the view is being added to the window using an animation. Discussion This method is called before the receiver’s view is about to be displayed onscreen and before any animations are configured for showing the view. You can override this method to perform custom tasks associated with presenting the view. For example, you might use this method to change the orientation or style of the status bar to coordinate with the orientation or style of the view being presented. If you override this method, you must call super at some point in your implementation.
For more information about the how views are added to windows, and the sequence of messages that occur, see the information on presenting a view controller’s view in “Custom View Controllers” in View Controller Programming Guide for iOS
精彩评论