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