[英]Segue in MPMoviePlayerPlaybackDidFinishNotification does no fire till second time
[英]Unable to call embedded segue the second time
我正在尝试构建一个类似于 Instagram 的应用程序,但我被困在评论部分。 在图像的左侧,它是一个 VC,它有一个嵌入式容器视图,底部有 UITextField 和 UIButton。 容器视图嵌入了一个 UITableView,其中包含所有用户配置文件图像、用户名和评论本身。
在第一次加载时,它可以完美地从服务器端抓取该帖子的所有评论,并完美显示。 但是,我无法使用prepareForSegue
再次调用 segue 来更新 UITableView。 我收到一个错误:
容器视图中有意外的子视图。 也许 embed segue 已经触发了一次,或者以编程方式添加了一个子视图?
以下是我的代码:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "getCommentSegue"){
if let destination = segue.destinationViewController as? CommentsTVC{
if(!self.commentID.isEmpty){
destination.UpdateCommentRow(self.profileImage, commentID: self.commentID, comment: self.postComment, dateTimePost: self.dateTime)
self.commentID = String()
}
destination.postID = self.postID
}
}
}
并在dispatch_async
向我的数据库成功添加一行后:
self.performSegueWithIdentifier("getCommentSegue", sender: nil)
我还注意到,当它将新评论附加到存储所有评论的现有对象时,它的计数为 0。我相信它正在为该对象获取新引用。 请帮忙!
将navigationcontroller
控制器嵌入到容器视图中,然后尝试。 我认为它可能会解决你的问题..!!
在调用performSegue
之前删除容器视图的子视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.