1

ナビゲーションバーにボタンを追加したいのですが。

今私がUIViewControllerを追加しているとき、私は使用しています:

pushViewCntroller

自動的に戻るボタンが追加され、タイトルを設定しています。右側にボタンを追加できますserRightBarButtonItem

しかし、戻るボタンの近くにボタンを追加したいのですが、どうすればよいですか?カスタマイズしたCGpointで追加できますか

4

1 に答える 1

0

次のように、ナビゲーションバーに複数のボタンを設定できます。

// Get a copy of the existing array listing your current buttons
NSMutableArray *leftButtonArray = [self.navigationItem.leftBarButtonItems mutableCopy];

// Create the UIBarButtonItem
UIBarButtonItem *newButton = <insert your code to create your button>;

// Add it to the array.  Adjust index 0 to move the button.
[leftButtonArray insertObject:newButton atIndex:0]; 

// Set the left buttons to the new array
self.navigationItem.leftBarButtonItems = leftButtonArray;
于 2012-09-15T17:11:47.310 に答える