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 回答