我有一个tabBar
个应用,有很多views
。有没有办法知道UIViewController
中当前是否可以看到特定的UIViewController
? (寻找property
)
答案 0 :(得分:0)
var onScreen: Bool = false
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated: animated)
onScreen = true
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated: animated)
onScreen = false
}
然后您就可以访问viewControllerInstance.onScreen
媒体资源。