English 中文(简体)
• 如何在航道上添加物项
原标题:how to add items to the navigation bar

我是新到的。

source code

UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"SAVE" 
                                            style:UIBarButtonItemStyleBordered 
                                                              target:self 
                                         action:@selector(saveButtonClicked)];

self.navigationItem.rightBarButtonItem = saveButton;

采用上述办法,即可以建立航行权担保项目,但可以在此增加更多物品......需要增加更多纽扣吨。

请向我提供一部样本代码,以尝试它。

Thanks for any help and thanks for your time

最佳回答

添加导航条条码

UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 133, 44.01)];
tools.tintColor = [UIColor blackColor];
// create the array to hold the buttons, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];

// create a standard "add" button
 bi = [[UIBarButtonItem alloc]
                       initWithTitle:@"Add" style:UIBarButtonItemStyleBordered  target:self action:@selector(addMedicine)];

[buttons addObject:bi];
[bi release];

// create a spacer


bi = [[UIBarButtonItem alloc]
      initWithTitle:@"Edit" style:UIBarButtonSystemItemEdit target:self action:@selector(edit)];

[buttons addObject:bi];
[bi release];


// stick the buttons in the toolbar
[tools setItems:buttons animated:NO];

[buttons release];

// and put the toolbar in the nav bar

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];

一切最好。

问题回答

http://www.cocoa Controls.com/controls/dactionheaderview”rel=“nofollow” DDActionHeaderView。 您可以方便地补充和管理项目。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签