Having a little problem with my NavBar buttons atm. I upgraded to Xcode 9 / ios 11 and suddenly the UIBarButtonItems which used to be little buttons on the side of navbar (like your back or edit buttons in standard ios apps) have begun stretching massively. Here is a photo:
My code is simply:
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: image2, style: .plain, target: self, action: #selector(messageScreen))
Does anyone know how to fix this? Thank you.
Swift:
let widthConstraint = button.widthAnchor.constraint(equalToConstant: 30)
let heightConstraint = button.heightAnchor.constraint(equalToConstant: 30)
heightConstraint.isActive = true
widthConstraint.isActive = true
Objective C:
[button.widthAnchor constraintEqualToConstant:30].active = YES;
[button.heightAnchor constraintEqualToConstant:30].active = YES;
// add those lines before setting navigation buttons