Domanda

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)?

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top