【发布时间】:2014-07-01 15:47:21
【问题描述】:
我想以编程方式向视图添加一个按钮,然后当用户按下此按钮时,加载名为“Giraanam”的第二个视图。我设法编写代码来显示按钮,但我不知道如何让它加载第二个视图...谁能帮帮我吗?
到目前为止我尝试的代码是:
let button = UIButton.buttonWithType(UIButtonType.System) as UIButton
button.frame = CGRectMake(20, 25, 34, 34)
button.backgroundColor = UIColor.greenColor()
button.setBackgroundImage(UIImage(named:"Back_Resultados.png"),forState: UIControlState.Normal)
button.addTarget(self, action: "Giraanam", forControlEvents: UIControlEvents.TouchUpInside)
self.addSubview(button)
【问题讨论】: