0
我想將數據從一個UIView傳遞到另一個UIView,以便訪問根據用戶選擇的UITabBarItem而不同的網站。我該怎麼做?以segue形式傳遞數據UITabBarItem不起作用
func pathButton(dcPathButton: DCPathButton!, clickItemButtonAtIndex itemButtonIndex: UInt) {
switch itemButtonIndex {
case 0:
// working but can’t send data with it
self.performSegueWithIdentifier("goto", sender: self)
// not working as function is not trigger
func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "goto" {
let vc = segue.destinationViewController as! WebMainViewController
vc.goURL = "http://google.com「
dcPathButton.delegate = self
println(「go to http//google.com」)
}
case 1:
println(「go to http://apple.com」)
case 2:
println(「go to http://imbd.com」)
case 3:
println(「go to http://facebook.com」)
default:
println(「go to http://cnn.com」)
}