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

私はhttp://osmorphis.blogspot.com/2009/05/multiple-buttons-on-navigation-bar.htmlで解決策を見つけました。 本当に役に立ちました。UIToolBarをサブクラス化することを忘れないでください。

于 2010-04-29T13:20:43.470 に答える
0

バーボタンアイテムの配列で、ボタンの前に固定スペースを配置してみてください。

于 2010-04-27T00:33:33.313 に答える