我想在导航栏中添加按钮。
现在,我正在使用以下方式添加UIViewController:
pushViewCntroller
并添加了自动后退按钮,我设置了标题。我可以使用serRightBarButtonItem
但我想在后退按钮附近添加按钮,我该怎么做?我可以通过自定义CGpoint
添加它吗?答案 0 :(得分: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;