尝试为我的注册按钮创建一个segue,它将发送用户到允许他们在我的数据库中注册的页面。在没有故事板的情况下以编程方式创建segue
通常,我做了一个按钮和我的按钮的目标,它通过一个函数执行一些操作。
我们可以使此功能赛格瑞PROGRAMMATICALLY
提醒你,我没有使用过的故事板呢?
代码段:
lazy var registerButton: UIButton = {
let rButton = UIButton(type: .system)
rButton.frame = CGRect(x: 210, y: 600, width: 100, height: 50)
rButton.setTitle("REGISTER", for: .normal)
rButton.backgroundColor = UIColor.white
rButton.translatesAutoresizingMaskIntoConstraints = false
rButton.setTitleColor(UIColor.black, for: .normal)
rButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20)
rButton.layer.cornerRadius = 20
rButton.layer.borderWidth = 2
rButton.addTarget(self, action: #selector(regSegue), for: .touchUpInside)
return rButton
}()
// will segue for me
func regSegue(){
}
任何帮助表示赞赏 – HiDungLing
@Idan可能不 – HiDungLing
的可能的复制[IOS - 如何Segue公司以编程方式使用SWIFT(http://stackoverflow.com/questions/27604192/ios-how-to-segue-以编程方式使用swift) – 2017-05-19 05:29:16