I'm wondering, is there a way to get a delegate or something, when a particular UIView
has been shown on the screen ?
The UIView class is a concrete class that you can instantiate and use to display a fixed background color. You can also subclass it to draw more sophisticated content.
Notifies the view controller that its view was added to a view hierarchy. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.0+ tvOS 9.0+
They are separate classes: UIView is a class that represents the screen of the device of everything that is visible to the viewer, while UIViewController is a class that controls an instance of UIView, and handles all of the logic and code behind that view.
viewDidLoad() is one of the initialization methods that is called on the initial view controller. viewDidLoad() is called before anything is shown to the user - and it is called only once.
Swift version. Inside your UIView class just:
override func willMove(toWindow newWindow: UIWindow?) { super.willMove(toWindow: newWindow) if newWindow == nil { // UIView disappear } else { // UIView appear } }
Try these:
– didAddSubview: – willRemoveSubview: – willMoveToSuperview: – didMoveToSuperview – willMoveToWindow: – didMoveToWindow - viewDidAppear:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With