两个标签是
一个UICollectionView,我将从现在开始引用为IntroVC
2.一个UITableView,我将其称为FeedVC
当用户在IntroVC中单击照片时,会触发Show segue(通过prepareForSegue)显示第三个屏幕(UIView),这在技术上不是一个选项卡.我将从现在开始将其称为SelectVC.
注意:所有这些屏幕也是在导航控制器中嵌入(ded).
SelectVC显示一张照片,并且有一个UIButton,用户可以按它触发一个Show segue和Unwind segue,将图像推送到FeedVC.我创建一个“放卷”的原因是因为没有它,图像将进入FeedVC(第二个选项卡),但是第一个选项卡仍然会被突出显示.
我解决了这个Unwind segue,但我注意到我有一个问题,在选择之后,当我按第一个选项卡(简介VC)导航栏有一个后退按钮,和更多的时间,我使用SelectVC按钮推动图像,我必须按照返回到IntroVC的次数越多.我很困惑如何解决这个问题.很明显,我没有正确地挂起流程,看来IntroVC是多次生成的?
当我通过模拟器中的段落时,我在控制台中收到以下消息:
Nested pop animation can result in corrupted navigation bar Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
任何帮助将不胜感激!
以下相关代码.
IntroVC.swift
@IBAction func unwindToIntroView(segue: UIStoryboardSegue) { self.tabBarController!.selectedIndex = 1 override func prepareForSegue(segue: UIStoryboardSegue,sender: AnyObject?) { if segue.identifier == "showFeedItem" { let selectScreenVC = segue.destinationViewController as! SelectScreenViewController let cell = sender as! UICollectionViewCell if let indexPath = self.collectionView!.indexPathForCell(cell) { self.navigationController?.popViewControllerAnimated(true) selectScreenVC.currentVenue = venueItems[indexPath.row] } }
SelectVC.swift
@IBAction func pushSelection(sender: UIButton) { var feedItem = FeedItem() if let currentItem = currentItem { feedItem.nName = currentItem.nName feedItem.imageFile = currentItem.lgImg feedItem.userName = PFUser.currentUser()!.username! feedItem.saveInBackgroundWithBlock({ (success: Bool,error: NSError?) -> Void in self.performSegueWithIdentifier("unwindToVenueView",sender: self) }) } }
我知道这是奇怪的结构,如果我缺少需要充分理解的信息 – 请让我知道,我会相应地进行编辑.谢谢.
解决方法
self.navigationController?.popViewControllerAnimated(true)
因为您在呈现SelectVC之前尝试从堆叠中弹出视图控制器.这可能是导致可能损坏的导航栏的原因(如果您弹出根视图控制器怎么办?).您可以尝试以下方法:
self.navigationController?.popToRootViewControllerAnimated(true)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。