【发布时间】:2016-04-05 06:35:18
【问题描述】:
我设计了一个基本上有一个 tableview 有一个 rootView 的应用程序,然后打算根据在根视图控制器上单击的行来加载三个控制器(2 个 tableview 和 1 个视图控制器)。我已经从根视图控制器向所有三个视图添加了当前模态segue。但视图没有被加载。我没有在视图之间传递任何数据。只加载视图。我试图加载视图的代码是
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”会打印在日志中。!
谁能指导我应该做什么?提前谢谢你..
【问题讨论】:
标签: ios swift uiviewcontroller segue