我是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
使用自动布局或编程在故事板?你可以在这里粘贴你的代码吗? –