我正在尝试创建一个看起来像 image-1 的 UIToolBar,但是我的操作输出确实是 image-2。我如何在其 Items 之间添加 UIToolBar 的阴影层和分隔符?
我确实找到了这个关于分隔符的问题,但那里没有答案 -> Separator between toolbar items in UIToolbar
最佳答案
GitHub 上还有一个库选项: https://github.com/iosphere/ISHHoverBar
编辑:
这就是您使用库 (ViewDidLoad) 的方式
UIBarButtonItem *mapBarButton = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView];
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[infoButton addTarget:self action:@selector(toggleOrientation:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *infoBarButton = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
[self.hoverbar setItems:@[mapBarButton, infoBarButton]];
关于ios - 如何在 UIToolBar 框架和 UIToolBarItems 之间的行分隔符上添加平滑的低阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41501870/