2016-08-12 3 views
0

私は1つのuitableviewcellを持っている場合、私は条件を満たすためにチェックする必要がありますし、別のビューに別のセグを実行する必要があります、どのように尋ねたかった?例:1つのuitableviewcellセグ2ビューできますか?

if subCat[indexPath.row] == ""{ 

     performSegueWithIdentifier("A", sender: self) 

    }else{ 

     performSegueWithIdentifier("B", sender: self) 

    } 

どのようにするのですか?そして私はそれをストーリーボードのsegueとどのように結びつけるべきですか?

+0

はい。最初のものと同じ方法で*コントローラを見る*に2番目のセグを接続します。あなたの例は大丈夫です。 –

+0

@ ShadowOfそれからどうすればいいですか?その他の方法で? – bobo

+0

https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson8.html#//apple_ref/doc/uid/TP40015214-CH16-SW1 –

答えて

-1

viewController 1にはストーリーボード識別子 "A"を、viewController 2には "B"を指定し、ナビゲーションを使用する場合はコントローラをプッシュすることもできます。

if subCat[indexPath.row] == "" { 
    let viewController1 = storyboard.instantiateViewControllerWithIdentifier("A") as! ViewController1 

    // if navigation controller used. 
    self.navigationController?.pushViewController(viewController1, animated: true) 

    // if navigation controller not used. 
    // self.presentViewController(viewController1, animated: true, completion: nil) 
}else{ 
    let viewController2 = storyboard.instantiateViewControllerWithIdentifier("B") as! ViewController2 

    // if navigation controller used. 
    self.navigationController?.pushViewController(viewController2, animated: true) 

    // if navigation controller not used. 
    // self.presentViewController(viewController2, animated: true, completion: nil) 
}