我有三个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];
Run Code Online (Sandbox Code Playgroud)