我有一个TableViewController。当单元格被点击时,会调用showEpisodes segue。这个segue设置为Show,并指向一个Navigation Controller,就像这样:。问题是我的视图以模态方式显示,即它没有一个导航控制器。以下是我在主表视图控制器中使用的代码:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath)
self.performSegueWithIdentifier("showEpisodes", sender: cell?.textLabel?.text)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showEpisodes" {
let viewController = segue.destinationViewController as! UINavigationController
let vc = viewController.topViewController as! EpisodesTableViewCOntroller
let indexPath: NSIndexPath = self.tableView.indexPathForSelectedRow!
let object: PFObject = self.objectAtIndexPath(indexPath)!
vc.podcast = object
// self.navigationController!.pushViewController(vc, animated: true)
}
如果我取消注释self.navigationController!.pushViewController(vc, animated: true)
这一部分,视图会被成功推出,但是一旦加载完成,一个黑色窗口就会以模态方式呈现在它上面。我已经在调试器中检查了UI层次结构,但没有成功。请问有什么想法吗?