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)];
听起来很奇怪,你能发布截图吗?听起来很奇怪,你能发布截图吗?