如何增加Xcode中导航栏的高度? [英] How to increase the height of navigation bar in Xcode?
本文介绍了如何增加Xcode中导航栏的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个应用程序,我需要在其中保留一个导航栏.当我在栏上写任何标题时,时间和标题会变得非常接近.我想增加吧台的高度,这样它就可以获得一些喘息的空间.
I'm working on a app, in which I need to keep a navigation bar. when I write any title on the bar, the time and the title kinda get very close to each other. I wanted to increase the height of the bar, so it can get some breathing room.
推荐答案
选择你的 ViewController --> 选择你的 Navigation Item --> Prompt --> 添加空格它增加 高度
**Navigation bar**
select your ViewController --> select your Navigation Item --> Prompt --> Add space it increase the height
of **Navigation bar**
在此处检查图像:
以编程方式
在 viewWillAppear 或 viewDidAppear 方法中添加它
Add this in viewWillAppear or viewDidAppear method
目标 C
[self.navigationController.navigationBar setFrame:CGRectMake(0, 0, self.view.frame.size.width,80.0)];
迅捷
self.navigationController.navigationBar.frame = CGRectMake(0, 0, self.view.frame.size.width, 80.0)
Swift-3
self.navigationController!.navigationBar.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 80.0)
iOS 11
目标 C
for (UIView *subview in self.navigationController.navigationBar.subviews) {
if ([NSStringFromClass([subview class]) containsString:@"BarBackground"]) {
CGRect subViewFrame = subview.frame;
// subViewFrame.origin.y = -20;
subViewFrame.size.height = 100;
[subview setFrame: subViewFrame];
}
}
迅速
for subview in (self.navigationController?.navigationBar.subviews)! {
if NSStringFromClass(subview.classForCoder).contains("BarBackground") {
var subViewFrame: CGRect = subview.frame
// subViewFrame.origin.y = -20;
subViewFrame.size.height = 100
subview.frame = subViewFrame
}
}
这篇关于如何增加Xcode中导航栏的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文