0

I am trying to use a custom button on my navigation bar in Xcode, but the button inherits the default bar button item properties and adjusts its size according to those properties. I want to override the default width. How do I do that?

I tried adding contents insets, but that did not change anything.This is how the button appears

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ewurafua Plange
  • 627
  • 1
  • 7
  • 20

1 Answers1

1

You should set your custom button's imageView's contentMode like:

myCustomButton.imageView.contentMode = .aspectFit

Enjoy

emrcftci
  • 3,355
  • 3
  • 21
  • 35