Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if the view is loaded at run time

Is there any way that I could see a view is loaded without checking the source code of that view controller (e.g., viewDidLoad, viewWillAppear, etc.)

or how can I check at the run time / dynamically if any view is loaded to grab the subviews.

like image 713
ramo Avatar asked Apr 03 '12 23:04

ramo


People also ask

What is the difference between viewDidLoad () and viewDidAppear ()?

The difference between viewDidAppear and viewDidLoad is that viewDidAppear is called every time you land on the screen while viewDidLoad is only called once which is when the app loads.

What is override func viewDidLoad ()?

Swift version: 5.6. The override is used when you want to write your own method to replace an existing one in a parent class. It's used commonly when you're working with UIViewControllers , because view controllers already come with lots of methods like viewDidLoad() and viewWillAppear() .

What is Loadview in iOS?

Creates the view that the controller manages. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.0+ tvOS 9.0+

What is viewDidLoad?

viewDidLoad is called when the ViewController has loaded its view hierarchy into memory. This is the point where you can perform your customized initialisation for your view controller. For instance, if your view controller has a UILabel and you want to set a custom text to it, this is the point where you do that.


1 Answers

If you have an instance of a view controller, you can ask it:

viewController.isViewLoaded
like image 140
danh Avatar answered Sep 19 '22 02:09

danh