【发布时间】:2020-02-21 10:08:33
【问题描述】:
基本上我有一个改变标题的按钮,如果按钮标题是什么我希望按钮将用户带到不同的地方,如果按钮标题是别的东西
let act1 = act1ViewController()
let act2 = act2ViewController()
override func viewDidLoad() {
super.viewDidLoad()
self.buttonName.setTitle(self.text, for: .normal)
// Do any additional setup after loading the view.
}
@IBAction func buttonPressed(_ sender: UIButton) {
if text == "cheer up" {
self.present(act1, animated: true, completion: nil)
}
else if text == "yay" {
self.present(act2, animated: true, completion: nil)
}
}
【问题讨论】:
标签: swift user-interface uiviewcontroller segue