【发布时间】:2016-02-18 18:07:00
【问题描述】:
我在我的项目中使用UINavigationController 内的UITabBarController。
在这个UINavigationController 里面有一个UICollectionView。在UICollectionView 中,点击集合中的项目后,应该执行 show segue 以查看某种详细信息页面,您可以从该页面返回或返回具有不同数据的另一个集合 -已应用过滤器。
作为 iOS 开发的新手,我很难让事情按我的意愿运行。即使故事板中的所有转场都设置为show,它们也会作为模态动画进行动画处理(从底部而不是右侧进入)。
也不会出现后退按钮。我在属性检查器中为其设置了文本(我已经知道这些必须在“消失”的视图中)并且还为所有导航项添加了标题……仍然没有显示它们的迹象。
这是我使用的prepareForSegue:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showService" {
if let indexPath = self.collectionView?.indexPathsForSelectedItems() {
let object = serviceData[indexPath.last!.row]
let controller = (segue.destinationViewController as! UINavigationController).topViewController as! ServiceDetailViewController
controller.serviceItem = object
controller.callerItem = self.name
controller.navigationItem.leftItemsSupplementBackButton = true
}
}
}
我在我的收藏视图的collectionView:didSelectItemAtIndexPath: 中触发了segue:
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
let cell = self.collectionView?.cellForItemAtIndexPath(indexPath)
performSegueWithIdentifier("showService", sender: cell)
}
【问题讨论】:
标签: iphone swift animation ios9 uistoryboardsegue