I am trying to add a basic Settings icon in the top right of the navigation bar. I added a UIBarButtonItem to my navigation bar. Then I set the image, but it moved the image to the center instead of staying in the right? Is there a way to fix this?
Asked
Active
Viewed 68 times
-3
-
https://stackoverflow.com/questions/27499998/how-to-set-image-for-bar-button-with-swift/35233701 – Bence Pattogato Feb 06 '19 at 17:20
-
I don't know what I'm supposed to do with that answer @BencePattogato. It is a different issue and not updated for Swift 4 either. – belgrim Feb 06 '19 at 17:25
-
I'm assuming you want that to be a settings **button**? If so, check the answers here https://stackoverflow.com/questions/30022780/uibarbuttonitem-in-navigation-bar-programmatically – DonMag Feb 06 '19 at 18:24
-
Looks like you got this resolved but in the future its better to post your code so others can diagnose it. – Dancreek Feb 06 '19 at 21:09
-
This was more of an Interface Builder issue than it was a code related issue @Dancreek – belgrim Feb 06 '19 at 21:11
1 Answers
0
Update: I fixed this by decreasing the dimensions of the icon closer to 40x40. It was too large.

belgrim
- 123
- 9