How to add smooth low shadow on UIToolBar frame and line separator between UIToolBarItems

673 views Asked by At

I am trying to create an UIToolBar looks like image-1 , however output of my operations did occur as image-2. How could I add a shadow layer of UIToolBar and separator between its Items ?

I did find this question for separator but there no answer in there -> Separator between toolbar items in UIToolbar

IMAGE-1

IMAGE-2

1

There are 1 answers

8
George_v On BEST ANSWER

You can check this apple doc : https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/UIKitUICatalog/UIToolbar.html#//apple_ref/doc/uid/TP40012857-UIToolbar

Also there is a library option on GitHub: https://github.com/iosphere/ISHHoverBar

EDIT:

This is how you use the 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]];