2011-07-31 9 views
1

UINavigationバーに約5つのボタンを追加する方法。NavigationBarに5ボタンを追加する方法

私は大丈夫、私たちは、私たちは、ナビゲーションバー上のボタンを追加しUIToolbarを使用してナビゲーション

放置するボタンと右を追加することができます。

ナビゲーションバーの周りに5つのボタンの周りに収まる方法は他にありません。リンゴが受け入れられる場所

答えて

0

いつでも[self.navigationController.navigationBar addSubview: abutton];を使用できます。

0
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:5]; 

// create a standard "1" button 
UIBarButtonItem* bi = [[UIBarButtonItem alloc] 
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:NULL]; 
bi.style = UIBarButtonItemStyleBordered; 
[buttons addObject:bi]; 
[bi release]; 

//for spacer 
bi = [[UIBarButtonItem alloc] 
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; 
[buttons addObject:bi]; 
[bi release]; 

// create a standard "2" button 
bi = [[UIBarButtonItem alloc] 
initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)]; 
bi.style = UIBarButtonItemStyleBordered; 
[buttons addObject:bi]; 
[bi release]; 

// and so on you can create rest button in the same way and add to tools 
// stick the buttons in the toolbar 
[tools setItems:buttons animated:NO]; 
[buttons release]; 
// and put the toolbar in the nav bar 
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools]; 
[tools release]; 
関連する問題