如何在iPhone应用程序中设置UINavigationBar的高度 [英] How do i set the height of the UINavigationBar in an iphone app

查看:138
本文介绍了如何在iPhone应用程序中设置UINavigationBar的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用UINavigationController的典型情况,id喜欢使导航栏更高一些。设置它的边界和框架似乎没有什么区别,我使用此代码

Im using a typical situation with UINavigationController, id like to make the navigation bar a bit taller. setting its bounds and frame dont seem to make a difference, im using this code

    //set up the navigation
UINavigationController *navigationController = [UINavigationController new];

[navigationController.navigationBar setBarStyle:UIBarStyleBlack];
[navigationController.navigationBar setTintColor:[UIColor purpleColor]];
[navigationController.navigationBar setBounds:CGRectMake(0.0, 0.0, 480.0, 100.0)];
[navigationController.navigationBar setFrame:CGRectMake(0.0, 0.0, 480.0, 100.0)];

但无济于事。有任何想法吗?

but to no avail. any ideas?

推荐答案

我认为你不能改变导航栏的高度。除非您添加提示消息...但这不是您想要的。

I don't think you can change the height of a navigation bar. Except when you add a prompt message... But that's not what you want.

框架是视图的可见区域。界限是内部区域。通常它的原点为(0,0),并且与帧一样宽和高。但是,当内容超出可见区域时(如使用UIScrollView),边界可能更大(原点不同)。你很少看到小于它们各自帧的边界。

Frame is the visible area of a view. Bounds is the internal area. Usually this has an origin of (0, 0) and is as wide and high as the frame. However, when the content exceeds the visible area (like with a UIScrollView) the bounds can be larger (and the origin different). You rarely see bounds that are smaller than their respective frames.

编辑:看看你的代码,[UINavigationController new]是什么?你应该做[[UINavigationController alloc] init],不是吗?

Looking at your code, what is [UINavigationController new] about? You should do [[UINavigationController alloc] init], shouldn't you?

另外,你所做的并不是真正的子类化......

Also, what you are doing is not really subclassing...

这篇关于如何在iPhone应用程序中设置UINavigationBar的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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