我正在开发一个带有Tab Bar Controller的swift应用程序,其中一个选项卡有一个导航控制器 . 带有导航控制器的选项卡具有表视图,表视图中的单元格转换为常规视图控制器 . 信息根据需要显示在目标视图控制器中,当显示目标视图控制器时,标签栏和导航栏都会消失 .
这是我的prepareForSegue:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "entryCellToEntryView" {
if let destination = segue.destinationViewController as? EntryDetailViewController {
if let index = customTableView.indexPathForSelectedRow {
if let cell = customTableView.cellForRowAtIndexPath(index) as? EntryTableViewCell {
destination.entryToDisplay = cell.entry
} else {
print("prepareForSeque: Unable to cast cell as EntryTableViewCell")
}
} else {
print("prepareForSeque: Index cannot be established")
}
} else {
print("prepareForSeque: Destination cannot be downcast to EntryDetailViewController")
}
}
}
这是我的故事板照片的链接:http://grantbroadwater.com/storyboard.png
1 回答
导航栏和标签栏消失,因为您正在使用模型segue .
Change segue to push are show.
在模型segue目标中,ViewController出现在当前viewController的顶部 . 因此目标视图控制器不了解您的导航堆栈或标签栏 .
如果您使用push segue,或者现在显示segue,那么只有它会被推入导航堆栈 .