Swift 处理应用程序中的用户交互
在我的应用程序中,当我想禁用用户交互时,我会使用此选项:Swift 处理应用程序中的用户交互,swift,swift3,user-interaction,Swift,Swift3,User Interaction,在我的应用程序中,当我想禁用用户交互时,我会使用此选项: UIApplication.shared.beginIgnoringInteractionEvents() 但上述行与以下行有何不同: self.view.isUserInteractionEnabled = false 何时使用上面的某些行有什么规则吗?self.view.isUserInteractionEnabled=false在单个UIView上工作,其中作为UIApplication.shared.beginIgnoring
UIApplication.shared.beginIgnoringInteractionEvents()
但上述行与以下行有何不同:
self.view.isUserInteractionEnabled = false
何时使用上面的某些行有什么规则吗?
self.view.isUserInteractionEnabled=false
在单个UIView
上工作,其中作为UIApplication.shared.beginIgnoringInteractionEvents()
包括整个ui窗口
意味着UINavigationBar
上的迭代不包括在self.view.isUserInteractionEnabled
中
如果您试图在执行某些UI操作(如绘图或动画)时暂停用户交互,并且不希望用户中断此过程,则应使用UIApplication.shared.beginIgnoringInteractionEvents()
如果您试图限制单个UIView
上的交互,比如说UILabel``或UIImage```那么您应该选择self.view.isUserInteractionEnabled=false
希望有帮助。快乐编码:)self.view.isUserInteractionEnabled=false
在个人UIView
上工作,其中作为UIApplication.shared.beginIgnoringInteractionEvents()
包括整个ui窗口
意味着UINavigationBar
上的迭代不包括在self.view.isUserInteractionEnabled
中
如果您试图在执行某些UI操作(如绘图或动画)时暂停用户交互,并且不希望用户中断此过程,则应使用UIApplication.shared.beginIgnoringInteractionEvents()
如果您试图限制单个UIView
上的交互,比如说UILabel``或UIImage```那么您应该选择self.view.isUserInteractionEnabled=false
希望有帮助。快乐编码:)谢谢你的回答。很高兴它有帮助。谢谢你的回答。很高兴它有帮助。