简体   繁体   English

iPhone在导航栏中添加项目/行按钮

[英]iPhone Add Item/Row Button in Navigation Bar

Is there a standard way to implement a button like the one below in a navigation bar? 有没有一种标准的方法来实现类似于导航栏中下面的按钮的按钮? If not I can, of course, just use an image or maybe a custom view but as it's used in quite a few apps I thought there may be a method I'm missing. 如果不能,我当然可以只使用图像或自定义视图,但是由于它在许多应用程序中使用,因此我认为可能缺少一种方法。

添加行/项按钮

UIBarButtonItem *barBtnItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add:)];

self.navigationItem.rightBarButtonItem=barBtnItem;
        [barBtnItem release];

this code use for creating + button. 此代码用于创建+按钮。

那是标准的UIBarButtonSystemItem系统图标( UIBarButtonSystemItemAdd )之一-看一下UIBarButtonItem类参考中的initWithBarButtonSystemItem:target:action:方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM