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