[英]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.