我是iOS開發新手。根據UILabel
需要顯示的選項,我列出了UITextFields
的下拉菜單。以快速編程方式隱藏TextFields?
UITextField
DropdownMenu
UITextField
UITextField
像上面提到的它顯示的啓動應用程序。更改下拉菜單後需要顯示標籤。
UITextField
DropdownMenu
UILabel
UITextField
UITextField
我知道如何使用label.hidden = true
隱藏UILabel
。但隱藏之後,UILabel
仍佔據着空間。之後,只有它顯示出兩個UITextField
。如果有任何方式在隱藏標籤後動態改變位置。
我已經編程用於創建文本字段和標籤:
let textField1 = UITextField(frame: CGRect(x: 20, y: 10, width: UIApplication.shared.statusBarFrame.size.width - 40, height:45))
let textField2 = UITextField(frame: CGRect(x: 20, y: textField1.frame.origin.y + textField1.frame.size.height + 10, width: UIApplication.shared.statusBarFrame.size.width - 40, height: 45))
let button = UIButton(frame: CGRect(x: 20, y: textField2.frame.origin.y + textField2.frame.size.height + 10, width: UIApplication.shared.statusBarFrame.size.width - 40, height: 45))
let label1 = UILabel(frame: CGRect(x: 20, y: button.frame.origin.y + button.frame.size.height + 10, width: UIApplication.shared.statusBarFrame.size.width - 40, height: 45))
let textField3 = UITextField(frame: CGRect(x: 20, y: label1.frame.origin.y + label1.frame.size.height + 10, width: UIApplication.shared.statusBarFrame.size.width - 40, height: 45))
let textField4 = UITextField(frame: CGRect(x: 20, y: textField3.frame.origin.y + textField3.frame.size.height + 10, width: UIApplication.shared.statusBarFrame.size.width - 40, height: 45))
您使用自動佈局或自動調整 –
使用自動佈局多個動態只有@ Anbu.Karthik – vara
使用自動佈局或編程在故事板?你可以在這裏粘貼你的代碼嗎? –