【发布时间】:2015-09-01 06:27:54
【问题描述】:
我已经以编程方式设置了这个按钮,我一直试图弄清楚当它被按下以转到另一个 ViewController 时如何。我一直在尝试查找发生这种情况所需的代码类型。我似乎找不到任何东西。
import UIKit
class ViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
let image = UIImage(named: "Camera.png") as UIImage!
let button = UIButton.buttonWithType(UIButtonType.System) as! UIButton
button.frame = CGRectMake(self.view.frame.width / 2 - 30, self.view.frame.size.height - 70, 70, 70)
button.setImage(image, forState: .Normal)
self.navigationController?.view.addSubview(button)
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
这就是我设置它的方式,请有人指导我使用我需要使用的正确类型的代码或给我一个示例。谢谢
【问题讨论】:
-
您需要如何从 1 个 VC 跳转到另一个 VC 的代码示例?