If I add a view as a subview like so
[self.view addSubview:mySubview];
Will there be called any method on mySubview, that I could override to add some custom behavior?
If I add a view as a subview like so
[self.view addSubview:mySubview];
Will there be called any method on mySubview, that I could override to add some custom behavior?
You can override these two:
Take a look in the documentation for
UIView
for similar methods.Adding a view to a (new) superview triggers
- (void)willMoveToSuperview:(UIView *)newSuperview
and
- (void)didMoveToSuperview
.See the UIView Reference for more.
Yes, There is a method which get called if one change the superview . you need to override the below method in your subview class.
From UIView Doucumentation
exep for special purpose is far better to customize you view in init phase, you have all you need and (more important) is a synchronous call.