1

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

Community
  • 1
  • 1
user3751548
  • 115
  • 11
  • could you show us a piece of code, what you have tried so far? – dirtydanee Jan 06 '17 at 09:19
  • @dirtydanee yes of course I could share , but torpillo did suggest good library I think , I am trying to use now . If I get negative issue about library , of course I am going to share :) – user3751548 Jan 06 '17 at 10:43

1 Answers1

2

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]];
George_v
  • 83
  • 7
  • Thanks for answer, I am working on library that you gave called as ISHHoverBar , however I cannot find any tutorial or trial about it. Could you have ? – user3751548 Jan 06 '17 at 10:41
  • I downloaded the sample app..seems helpful. – George_v Jan 06 '17 at 10:54
  • 1
    Thank you, When I convert it swift I am going to share here :) – user3751548 Jan 06 '17 at 11:12
  • @torpillo when I wrote this `let x = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: nil) floatingButton.items?.append(x) ` , nothing gonna be added on floating Button. Of course I linked to floatingButton as `@IBOutlet weak var floatingButton: ISHHoverBar! ` – user3751548 Jan 06 '17 at 11:51
  • I did solve problem because it comes along nil value that's okey. But when I use auto layout on Interface Builder , view was going to be large width.. How could I from escape this ? – user3751548 Jan 06 '17 at 12:01
  • 1
    actually it's looks like bug. Because when I try to it with leading constraint it's going to be large width than accepted.Trailing constraint works as accepted... :) – user3751548 Jan 06 '17 at 12:27
  • Happy to hear that you solved it, keep me on track for this if you need something (name changed from torpillo to George_v) – George_v Jan 06 '17 at 13:07
  • do you have any idea about this question ? http://stackoverflow.com/questions/41506333/how-to-change-mkusertrackingbarbuttonitem-style – user3751548 Jan 06 '17 at 13:50