0

enter image description here

This is my navigation bar, the instance of UINavigationBar. Now, I want the leftBarButtonItem move left, how can i do? The platform is iOS 11.

XM Zhang
  • 123
  • 1
  • 10

1 Answers1

2

I hope this helps,

Under the bar button item, assist menu. Change the image inset to negative

enter image description here

gurmandeep
  • 1,227
  • 1
  • 14
  • 30
  • Is that an image? Please share some code details as well – gurmandeep Nov 08 '17 at 09:43
  • It is a button, and the barButtonItem's frame is (0,0,44,44),but it's actual x is not 0. I want to make barButtonItem's x 0. – XM Zhang Nov 08 '17 at 09:50
  • I suppose you have added a navigation item -> Left Bar button -> Bar button item? Or you adding something different? – gurmandeep Nov 08 '17 at 10:04
  • Bar button item UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn]; – XM Zhang Nov 08 '17 at 10:20
  • and where are you adding it? Can you share the whole of Navigation bar and the items – gurmandeep Nov 08 '17 at 10:40
  • self.leftBarButtonItems = @[item]; – XM Zhang Nov 08 '17 at 10:43
  • Check this then, https://stackoverflow.com/questions/18861201/uibarbuttonitem-with-custom-view-not-properly-aligned-on-ios-7-when-used-as-left – gurmandeep Nov 08 '17 at 10:53
  • It not works too, I overwritten the navigationBar, a foolish way...Thanks for your help!! – XM Zhang Nov 09 '17 at 01:30
  • Ok, if you can share the navigation bar code also, i can surely help – gurmandeep Nov 09 '17 at 05:13
  • My navigation bar code is very easy, I new a button firstly, then I init a navigationBarItem with the button, then I put this button to an array, finally assign the array to self.leftBarButtonItems. Just like this, UIButton *btn = [UIButton new]; UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn]; self.leftBarButtonItems = @[item]; – XM Zhang Nov 09 '17 at 06:27
  • OK, when I have leisure time, I will research this problem, Thank you! – XM Zhang Nov 09 '17 at 06:48