Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 加上“+&引用;导航栏中的按钮_Iphone_Objective C - Fatal编程技术网

Iphone 加上“+&引用;导航栏中的按钮

Iphone 加上“+&引用;导航栏中的按钮,iphone,objective-c,Iphone,Objective C,我试图在导航栏中添加一个“添加按钮”,但创建的按钮是一个没有文本的矩形按钮,而不是“+”按钮,为什么 UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonSystemItemAdd target:self action:@selector(ajouterItem)]; self.navigationItem.rightBarButtonItem = addButton;

我试图在导航栏中添加一个“添加按钮”,但创建的按钮是一个没有文本的矩形按钮,而不是“+”按钮,为什么

UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonSystemItemAdd target:self action:@selector(ajouterItem)];

self.navigationItem.rightBarButtonItem = addButton;

[addButton release];

你把初始值设定项和标题/风格的初始值设定项弄混了。您需要此表单:

-(id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)系统项目标:(id)目标操作:(SEL)操作

可以这样称呼:

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

你把初始值设定项和标题/风格的初始值设定项弄混了。您需要此表单:

-(id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)系统项目标:(id)目标操作:(SEL)操作

可以这样称呼:

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

听起来很奇怪,你能发布截图吗?听起来很奇怪,你能发布截图吗?