質問

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

役に立ちましたか?

解決

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.

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top