在Cocoa Touch中更改NavigationBar和UIBarButtonItem元素的高度 [英] Change the height of NavigationBar and UIBarButtonItem elements inside it in Cocoa Touch

查看:161
本文介绍了在Cocoa Touch中更改NavigationBar和UIBarButtonItem元素的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想它不完全符合苹果的指导方针,但我想它一定是可能的。我想更改UINavigationController内的导航栏的高度和UIBarButtonItem元素在该栏内的高度。

I suppose it's not strictly in line with Apple guidelines but I guess it must be possible somehow. I'd like to change the height of navigation bar inside UINavigationController and the height of UIBarButtonItem elements inside that bar.

使用这个问题我设法改变导航栏的高度,但我看不到调整条形图按钮项目的高度。

Using a trick from this question I managed to change the height of navigation bar but I can see no way of adjusting the height of bar button items.

如果有人知道如何更改bar按钮项目的大小,请帮助我。

If anyone knows how to change the size of bar button items, please help me out.

推荐答案

也许有关自定义导航栏的本教程将帮助您:重新创建iBooks木制主题导航栏

Maybe this tutorial about a customized navbar will help you: Recreating the iBooks wood themed navigation bar

如果您使用 UIImageView BarButtonItem 你可以改变自定义UIImageView的framesize / boundsize

If you create a BarButtonItem with a UIImageView you can maybe change the framesize/boundsize of the custom UIImageView

UIImageView* imageView = [[[UIImageView alloc] initWithFrame:navigationController.navigationBar.frame] autorelease];
imageView.contentMode = UIViewContentModeLeft;
imageView.image = [UIImage imageNamed:@"NavBar-iPhone.png"];
[navigationController.navigationBar insertSubview:imageView atIndex:0];

因此,为了您的需要,您可以给予 -initWithFrame 方法适当的值。

So for your need you would give the -initWithFrame method appropriate values.

这篇关于在Cocoa Touch中更改NavigationBar和UIBarButtonItem元素的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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