No there is no viewDidAppear
in UIView
. you may override func drawRect
to do any UI changes that you need on UIView
inherited View.
SideNote - In case you want get drawrect
to update at later times, Call setNeedsDisplay
. setNeedsDisplay
will not immediately call drawRect
but marks the receiver’s entire bounds rectangle as needing to be redrawn.
In other words - You should never call drawRect yourself. Instead, you tell the system that drawing needs to be done by using the setNeedsDisplay method, which marks the view as dirty. And the drawRect method of the subclass would then be called during the next update cycle.
As per the queries from OP(@Alexander), he just need to set some variable so it advisable to use any of the following override functions, depending on action need to be performed
-(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.
-(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.
viewDidAppear
is the method inUIViewController
. We could have find proper solution, if you share what you are trying to achieve? – Chinn