我設計了一個應用程序,基本上有一個tableview有一個rootView,然後三個控制器(2個tableviews和1視圖控制器)打算加載基於單擊行根視圖控制器。我已經添加了現在模態segue從根視圖控制器的所有三個視圖。但視圖沒有被加載。我沒有在視圖之間傳遞任何數據。只加載視圖。在那裏我試圖加載意見的代碼是無法從另一個表視圖加載另一個tableView
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
NSLog("It did enter the didselectRowAtIndexPath")
if (indexPath.section == 0){
func prepareForSegue(segue : UIStoryboardSegue , sender : AnyObject?) {
segue.destinationViewController as? DetailsViewController
NSLog("Loading Details view controller")
}
}
if (indexPath.section == 1){
func prepareForSegue(segue : UIStoryboardSegue , sender : AnyObject?) {
segue.destinationViewController as? AppCatalogViewController
NSLog("Loading AppCatalog view controller")
}
}
if (indexPath.section == 2){
func prepareForSegue(segue : UIStoryboardSegue , sender : AnyObject?) {
segue.destinationViewController as? supportViewController
NSLog("Loading support view controller")
}
}
}
注:「它沒有進入didSelectRowAtIndexPath方法」被印在日誌中。!
任何人都可以指導我應該做什麼?預先感謝您。
當我嘗試這樣做時,應用程序崩潰的錯誤是它沒有名爲「-theseguename-」的segues,儘管我正確地命名了segues ..在我再次檢查名稱之前,是否還有其他任何可能產生這個錯誤? –
@ManeeshSharma你在哪裏命名賽格?你是否從視圖控制器或表格視圖單元中拖動了segue? – MudOnTire
將它命名爲stortyboard的屬性檢查器,並將其從視圖控制器中拖出,而不是從表格視圖單元格中拖出。 –