Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIBarButtonItem offset

you can see the distance to the left of the button? How to remove this distance?

enter image description here

like image 731
user1771125 Avatar asked Feb 19 '23 11:02

user1771125


1 Answers

Add a spacer to the left of the button, something like:

UIBarButtonItem *backButtonItem = ....;

UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
spacer.width = -5; 

self.navigationItem.leftBarButtonItems = @[ spacer, backButtonItem ];
like image 167
Oliver Atkinson Avatar answered Feb 27 '23 19:02

Oliver Atkinson