公告
财富商城
积分规则
提问
发文
2020-08-17 17:17发布
男人必须洒脱
How to add a separator between buttons in a UIToolbar?
Sample image is shown in the below link
I did it with a custom view button, with a 1 pixel wide background:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 1, 44)]; label.backgroundColor = [UIColor whiteColor]; UIBarButtonItem *divider = [[UIBarButtonItem alloc] initWithCustomView:label]; // Add button to array of toolbar items [items addObject:divider]; // Or set items directly: //toolbar.items = [NSArray arrayWithObject:divider]; label.text = @"";
You can also make a toolbar button and set the Title = |
I can think of two ways :
(a) You could make them very thin toolbar buttons with user interaction disabled.
(b) Your other choice would be to implement your own toolbar. I'd try (a) first ;)
If yo want a clean, simple layout I would prefer a very thin image with this separator in it. Then you can add fix distances between your normal button, the separator image button (user interaction disabled) and the next button.
最多设置5个标签!
I did it with a custom view button, with a 1 pixel wide background:
You can also make a toolbar button and set the Title = |
I can think of two ways :
(a) You could make them very thin toolbar buttons with user interaction disabled.
(b) Your other choice would be to implement your own toolbar. I'd try (a) first ;)
If yo want a clean, simple layout I would prefer a very thin image with this separator in it. Then you can add fix distances between your normal button, the separator image button (user interaction disabled) and the next button.