最佳答案
我有三个 UIBarButtonItem
创建如下。它们向左对齐,我想向中心对齐,这样右边就不会有空隙了。我在 UIToolBar
上没有看到对齐属性。还有别的办法吗?
//create some buttons
UIBarButtonItem *aboutButton = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStyleBordered target:self action:@selector(showAbout:)];
[toolbar setItems:[NSArray arrayWithObjects:settingsButton,deleteButton,aboutButton,nil]];
//Add the toolbar as a subview to the navigation controller.
[self.navigationController.view addSubview:toolbar];