简体   繁体   中英

iphone UIView - Get notified when view has loaded?

I have a subclass of UIView, I want to be notified as soon as the view is loaded on the screen. Is there some kind of delegate method for a UIView.


NOTE: I am not using a UIViewController

There is no delegate method but you can override,

- (void)didAddSubview:(UIView *)subview{
}

如果您不使用OpenGL,可以使用- (void)drawRect:(CGRect)rect

Set the class which opens your view as the delegate of the view, then on viewDidLoad (which runs as soon as the view is opened, even if it's not by a viewController per se) notify the delegate. That should work, I believe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM