The IBOutlet
will be set after loadView
is called. This is automatically called the first time you access the view
property on your view controller.
when is my Outlet bound with the IB element?
-
31-07-2022 - |
Frage
I created an element using IB. Then, I link that element with the proper outlet from the ViewController.
When is this element bound with my outlet?
As an example:
We are using a Storyboards.
We have set the custom class for the viewController/scene to MyViewController
The outlet is an IBOutlet UILabel *
@interface MyViewController : UIViewController
@property (nonatomic, retain) IBOutlet UILabel * myLabel;
@end
We create an instance of MyViewController using
- (id)instantiateViewControllerWithIdentifier:(NSString *)identifier
We present this new instance to the user.
When does myLabel point to something valid(not nil)?
Lösung
Andere Tipps
If you hooked it up correctly in your viewController
it will be loaded when the app opens. There is no need to worry about how fast it will be loaded, as the user will not notice it.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow