2016-11-08 114 views
-1

我根据这个教程创建自定义标签栏:https://github.com/codepath/ios_guides/wiki/Creating-a-Custom-Tab-Bar自定义标签栏,详情查看

一切都很好,但是当我想从某个视图控制器Segue公司以它的“详细信息查看”,细节视图覆盖了带菜单的底部栏。这种行为是合乎逻辑的,因为我正在推新视图控制器,但是为了保持底部栏始终可见并且功能正常,我该如何做?

我为此使用了segue,因为我需要传递一些数据。我需要自定义栏,因为使用Apple的功能和外观很难实现。

任何提示或建议? 感谢

编辑: 这里所有的“标签”运作良好,但是当你在一排点击我浏览到“详细信息”查看

enter image description here

Details view

在细节视图,底部栏不可见。

+0

是否设置了步骤9中提到的contentView – Joe

+0

是的,我已经完成了所有教程我的步骤工作正常。这个问题是与详细信息视图,这不包括在本教程:( – repoguy

+0

可以发布你的问题的一些截图 – Joe

回答

0

你有没有试过设置hidesBottomBarWhenPushed = false的详细视图?

+0

我没有使用UITabBarController。它全部基于UIViewControllers,我的底部条仅仅是一个UIView没有hidesBottomBarWhenPushed属性 – repoguy

+0

容器视图只不过是一个UIView,我用它来显示每个选项卡的UIViewControllers。问题可能是如何从视图控制器在容器视图中导航到另一个视图控制器与segue,这样两个有相同的尺寸? – repoguy

0

解决了它。相反,在

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() 
      } 
     } 
    }