size of button on navigation bar Xcode9.4

1.9k Views Asked by At

i was working on Xcode 8.2 and everything was fine in my interfaces but when i update my Xcode to Xcode9.4 and i open the main.storyBoard and all the buttons in the navigation bar sizes is change and it is extremely increase

Screenshot Xcode

enter image description here

i try to change the width but it does not allow me to change the number of the width i have no idea about what is happen

what i can do to change the size

thanks

1

There are 1 best solutions below

0
Ankit Jayaswal On BEST ANSWER

As per the changes in iOS 11, either you have to take image of correct pixels( for ex: 32x32) or you must set constraints to the bar button items.

1. You must set constraint to bar button

Suppose you have taken outlet of your back button as:

    @IBOutlet weak var backBarButton: UIButton!

In viewDidLoad, Set:

    backBarButton.heightAnchor.constraint(equalToConstant: 32).isActive = true
    backBarButton.widthAnchor.constraint(equalToConstant: 32).isActive = true

2. Take image of pixel size 32x32

Use back button with pixel size of 32X32, as navigation button takes the content size of image.

enter image description here