解決了它。相反,在
tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
調用
self.performSegueWithIdentifier("detailsViewSegue", sender: self)
的我添加DetailsView控件以層次結構如下所示:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let detailsView = storyboard.instantiateViewControllerWithIdentifier("contactDetailsView")
addChildViewController(detailsView)
detailsView.view.frame = CGRectMake(self.view.frame.width, 0, self.view.frame.width, self.view.superview!.frame.height)
self.view.addSubview(detailsView.view)
UIView.animateWithDuration(0.25) {
detailsView.view.frame = CGRectMake(0, 0, self.view.frame.width, self.view.superview!.frame.height)
}
detailsView.didMoveToParentViewController(self)
那麼當用戶點擊後退箭頭我做的:
@IBAction func goBackButtonAction(sender: UIButton) {
self.willMoveToParentViewController(self)
UIView.animateWithDuration(0.25, animations: {
self.view.frame = CGRectMake(self.view.frame.width, 0, self.view.frame.width, self.view.frame.height)
}) { (completed) in
if completed {
self.view.removeFromSuperview()
self.removeFromParentViewController()
}
}
}
是否設置了步驟9中提到的contentView – Joe
是的,我已經完成了所有教程我的步驟工作正常。這個問題是與詳細信息視圖,這不包括在本教程:( – repoguy
可以發佈你的問題的一些截圖 – Joe