2012-12-17 48 views
3

好吧,我一直在寻找在iPhone的iCal应用程序,并且是出于好奇,最上面一栏是一个导航栏或工具栏?香港专业教育学院尝试同时使用,而且我想不出如何更改按钮的大小在右上角的+按钮...很迷茫..我假设它是一个导航栏,以尽可能小,但是当我阅读导航栏的描述,它说,每当你添加一个按钮或项目到酒吧,你不能直接连接它...不知道怎么回事做到这一点......但这个问题的人想帮助吗?导航栏或工具栏的问题在Xcode

+0

你能不能请张贴一些截图? –

+0

我如何摆放截图? @Dpk – trludt

+0

http://productivebydesign.free.fr/wp-content/images/iphone_calendar.png 有一个在iPhone的日历应用程序的PIC ..即时通讯谈论的顶栏..什么样的酒吧是它,并阅读其余的帖子^^ @Dpk – trludt

回答

6

如果你提的关于this one 它不是UITabBar,它是UINavigationBar,在最左边的按钮是UINavigationBar内置后退按钮和,在右边是一个额外的按钮,您可以添加,其明确this question所示,与更改类型(即+按钮),你可以简单地使用

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
                    style:UIBarButtonSystemItemAdd target:nil action:nil]; 

添加按钮的按钮样式改变为UINavigationBar

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
    style:UIBarButtonSystemItemAdd target:nil action:nil]; 
rightButton.width=10; 
rightButton.height=10; 
    UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Title"]; 
    item.rightBarButtonItem = rightButton; 
    item.hidesBackButton = YES; 
    [bar pushNavigationItem:item animated:NO]; 
    [rightButton release]; 
    [item release]; 

但通常你将有一个导航控制器,让你写:

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
    style:UIBarButtonSystemItemAdd target:nil action:nil]; 
self.navigationItem.rightBarButtonItem = rightButton; 
[rightButton release]; 

希望这有助于 问候

+0

这工作..我只是想知道如何改变该按钮的大小?我不知道如何改变一个栏按钮项目的宽度...... @Dpk – trludt

+0

@trludt可以调整的UIBarButtonItem的宽度和高度,使用buttton.width和按钮.height财产,检查我更新的答案,亲切接受它,如果有帮助,谢谢 –

2

enter image description here

用红色圆圈上面一栏是UINavigationaBar &与酒吧绿圈是定制设计。 您可以定义下面写的代码添加系统使用添加按钮UINavigationaBar

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" 
                    style:UIBarButtonSystemItemAdd target:nil action:nil]; 
+0

你知道如何缩小按钮尺寸吗?就像导航栏右上角的+按钮一样。我知道它必须是一个酒吧按钮项目,但我不知道如何改变它的大小..帮助? @hpIOSCoder – trludt

0

我意识到,其实你不需要代码来获取按钮缩小到+按钮的大小日历应用的右上角。事实上,一旦你在故事板中。打开右侧的实用程序选项卡。然后打开属性检查器。以及标识符的位置,下拉选项卡有选项。选择添加选项。