문제

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