[英]Xcode 6.3.1, Swift, iOS 8 Interface Builder - Uninstall button when landscape
设备在横向时是否可以卸载按钮?
我本以为可以像卸载约束一样卸载按钮-但我无法解决。
在界面构建器中找到它:
这是一种方法:
@IBOutlet weak var btn_MyButton: UIButton!
override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {
switch UIDevice.currentDevice().orientation{
case .LandscapeLeft:
btn_MyButton.hidden = true
case .LandscapeRight:
btn_MyButton.hidden = true
default:
btn_MyButton.hidden = false
}
}
您可以删除或隐藏按钮
btn.removeFromSuperview()
//or
btn.hidden = true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.