1

我用这个方法创建了一个 rightBarButtonItem:

- (UIBarButtonItem *)customBarButtonWithSelector:(SEL)callback {
 UIButton *customButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
 customButton.bounds = CGRectMake(0, 0, 30.0f, 30.0f);
 return [[[UIBarButtonItem alloc] initWithCustomView:customButton] autorelease];
}

在执行时,当在按钮外部(靠近中间)触摸条时触发选择器。

有没有办法将事件响应者限制在定义的范围内或可接受的范围内?

4

2 回答 2

0

尝试在条形按钮项数组中的按钮之前放置一个固定空格。

于 2010-04-27T00:33:33.313 回答
0

我在http://osmorphis.blogspot.com/2009/05/multiple-buttons-on-navigation-bar.html找到了解决方案 真的很有帮助,别忘了继承 UIToolBar。

于 2010-04-29T13:20:43.470 回答