简体   繁体   中英

How can I determine which view is active?

I have a viewController, with 5 views and I want to initialize some stuff depending on the view so in the viewDidLoad() , I want to do a :

if self.view == view1 { // Stuff here }
if self.view == view2 do { // Stuff here }

But it's doesn't work. So how can I detect the active view?

if([self.view1 isFirstResponder]){
//Do some nice stuff
}

You can do it with isFirstResponder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM