我想提出一个自定义按钮,右侧导航栏按钮项目。 下面是代码:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"my.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(filterResult) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(0, 0, 50, 50)];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease];
问题是,我可以看到它周围只有图像,而不是像按钮谈到了UIBarButtonSystemItemAdd或其他类型。
我该怎么办?