[英]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 : 我有一个viewController,有5个视图,我想根据视图初始化一些东西,所以在
viewDidLoad()
,我想做一个:
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
您可以使用
isFirstResponder
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.