是否可以平衡按钮的位置(Safari中的示例工具栏)?
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
target:self action:@selector(support:)];
UIBarButtonItem *next = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
target:self action:@selector(support:)];
[self.navigationController.toolbar setItems:[NSArray arrayWithObjects:infoButton, next,nil] animated:YES];
Run Code Online (Sandbox Code Playgroud)

您需要在两个按钮项之间添加一个灵活的空间项.
Apple的UICatalog示例代码中提供了更多详细信息.例如:
// flex item used to separate the left groups items and right grouped items
UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2509 次 |
| 最近记录: |