4
我试图在两个视图控制器(模式地提供的第二个模式)之间创建传递从API解析的数据的过渡。基于这些数据创建一个按钮(它影响按钮所说的内容)。这是API调用的封闭内,并且我存储类(即self.data = returnedData)使用Swift通过视图控制器传递数据而不使用Storyboard
let button = UIButton.buttonWithType(UIButtonType.System) as UIButton
button.frame = CGRectMake(0, 100, UIScreen.mainScreen().bounds.width, 50)
button.backgroundColor = UIColor.whiteColor()
button.setTitle("\(buttonTitleInfo)", forState: UIControlState.Normal)
button.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(button)
然后内返回的数据到一个变量:
func buttonAction(sender:UIButton!)
{
// the data is usable here but I don't know how to pass it via this button
let viewController:UberWebviewController = UberWebviewController()
self.navigationController?.presentViewController(viewController, animated: true, completion: nil)
}
我不使用故事板或IB以及我发现的大多数教程/解决方案都使用了特定的东西。
如何传递不使用这些返回的数据?
感谢@Aaron Brager从哈姆扎:)他是我的办公室伴侣 – abdulrauf618 2015-07-31 06:47:24