我有一个从主 TabBarController 扩展并扩展 ViewController 的 NavigationController 和 VC 扩展至 2x TableView (因此, TabBar -> NavigationController -> ViewController -> 2xTableView[with .xib] )。我必须将导航栏添加到导航控制器以使其在 viewController 中工作,因此在两个表视图中都可以工作(因为我使用Instagram 风格的滑动 https://raw.githubusercontent.com/uacaps/ResourceRepo/master/PageMenu/PageMenuDemoSegmentedControlGif.gif通过使用PageMenu https://github.com/uacaps/PageMenu)。现在,我可以看到导航栏。 (请注意,我必须取消选中Translucent
在 Storyboard 的导航栏上使其可见)
然而,它很宽,所以我试图缩小高度。我尝试了在网上找到的几个答案,但没有运气。首先,我尝试向导航栏添加约束(在 NavCont 中),但是当我单击约束时,所有内容都被禁用(...但例如,当我从故事板更改导航栏的颜色时,它会起作用。)
另外,在我的 ViewController 中(我链接到 TableView使用此代码 https://github.com/uacaps/PageMenu/blob/master/Demos/Demo%205/PageMenuDemoSegmentedControl/PageMenuDemoSegmentedControl/ViewController.swift),所以我可以使用这些并自定义导航栏,但是当我尝试时
// These works
self.title = "GLOBAL"
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.blackColor()]
// Neither works for Height
self.navigationController?.navigationBar.frame.size.height = 200
self.navigationController?.navigationBar.frame = CGRectMake(0, 0, 320, 64)
self.navigationController?.navigationBar.frame.origin.y = -50
我想要实现的导航栏的高度(并且通过简单地拖动导航栏在故事板上查看来实现另一个 UIView):
这就是它的样子
为另一个 UIView 实现,只需拖动导航栏即可在 Storyboard 上查看
是的,但这就是区别——世界上所有的区别。你可以做任何你想做的事your导航栏。但是 UINavigationController 拥有和提供的导航栏的高度并不取决于您。它不是您的导航栏,您应该放弃改变其大小的所有希望;导航控制器负责,而不是你。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)