如何在xcode中增加导航栏的高度? [英] how to increase the height of navigation bar in xcode?

查看:435
本文介绍了如何在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 - >选择导航项 - - > 提示 - >添加空间 增加 <$ c的高度 $ c> **导航栏**

select your ViewController --> select your Navigation Item --> Prompt --> Add space it increase the height of **Navigation bar**

在此处查看图片:

Check Image here :

以编程方式

viewWillAppear 中添加此项或 viewDidAppear 方法

Objective-C

[self.navigationController.navigationBar setFrame:CGRectMake(0, 0, self.view.frame.size.width,80.0)];

Swift

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];
    }
}

swift

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆