我设计了一个应用程序,它基本上有一个 tableview 有一个 rootView ,然后三个 Controller (2 个 tableviews 和 1 个 View Controller )旨在根据在 Root View Controller 上单击的行进行加载。我已将当前模态序列添加到 Root View Controller 的所有三个 View 中。但 View 没有被加载。我没有在 View 之间传递任何数据。仅加载 View 。我尝试加载 View 的代码是
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”会打印在日志中。
谁能指导我应该做什么?提前谢谢您..
最佳答案
使用performSegueWithIdentifier:与prepareForSegue不同,prepareForSegue是在执行segue之前执行的,它用于对要呈现的 View Controller 进行一些设置。
关于ios - 无法从另一个 TableView 加载另一个 TableView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36418793/