我創建了一個tableview菜單,當你點擊一個單元格來顯示特定的故事板時,我希望這個菜單。菜單從4格(所以4個不同的故事板)當桌面視圖中的單元格被點擊時,什麼也沒有發生
格式化這裏是我的代碼:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
_ = tableView.indexPathForSelectedRow!
if let _ = tableView.cellForRowAtIndexPath(indexPath){
if indexPath.row == 0{
print("User choose to buy ticket")
self.storyboard?.instantiateViewControllerWithIdentifier("SearchPage")
}else if indexPath.row == 1{
print("User choose to check the train status")
self.storyboard?.instantiateViewControllerWithIdentifier("TrainStatusPage")
}else if indexPath.row == 2{
print("User choose to see the upcoming trips")
self.storyboard?.instantiateViewControllerWithIdentifier("TripsPage")
}else if indexPath.row == 3{
print("User wants to know mor about CFR's facility")
self.storyboard?.instantiateViewControllerWithIdentifier("PassengersPage")
}
}
}
當我按下電池(並不重要)的細胞變成灰色,並沒有發生。
我想,這將是更好地開始在這一點上塞格斯。看看http://www.codingexplorer.com/segue-swift-view-controllers/ –