1

UIToolBar を image-1 のように作成しようとしていますが、操作の出力は image-2 として発生しました。UIToolBar のシャドウ レイヤーとその Items 間のセパレーターを追加するにはどうすればよいですか?

セパレーターについてこの質問を見つけましたが、そこには答えがありません-> UIToolbarのツールバー項目間のセパレーター

画像-1

画像-2

4

1 に答える 1

2

このアップルドキュメントを確認できます:https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/UIKitUICatalog/UIToolbar.html#//apple_ref/doc/uid/TP40012857-UIToolbar

また、GitHub にはライブラリ オプションがあります: https://github.com/iosphere/ISHHoverBar

編集:

これは、lib (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]];
于 2017-01-06T09:51:51.570 に答える