Is there anything similar to the viewDidLoad
of UIViewController
for a UIView
???
I need to be notified as soon as a UIView
has loaded (Subclass of UIView
), and perform some actions.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Depending on what kind of actions you need to perform, there are several techniques:
-(id)initWithFrame:(CGRect)frame
- UIView's designated initializer; always sent to a UIView to initialize it, unless the view is loaded from a nib;-(id)initWithCoder:(NSCoder *)coder
- always sent to initialize a UIView whenever the view is loaded from a nib;-(void)awakeFromNib
- sent after all the objects in the nib are initialized and connected; applicable only if you load the object from a nib; you must call super;-(void)willMoveToSuperview:(UIView *)newSuperview
- sent immediately before the view is added as a subview to another view;newSuperview
may be nil when you remove the view from its superview;-(void)willMoveToWindow:(UIWindow *)newWindow
- sent immediately before the view (or its superview) is added to a window;newWindow
may be nil when you remove the view from a window;-(void)didMoveToSuperview
- sent immediately after the view is inserted into a view hierarchy;-(void)didMoveToWindow
- sent immediately after the view gets its window property set. -Basically, you can choose to perform your actions during initialization (1 & 2), after loading from a nib (3), before insertion into a view hierarchy (4 & 5) and after that (6 & 7).