Previously, I implemented code to apply asset catalog image to navigationBar's barbuttonitem by referring to the best answer from the following site, and it worked well.
https://stackoverflow.com/questions/31473359/image-for-nav-bar-button-item-swift
The other day, when I built the Deployment target at 10.3 in Xcode 10.0, the scaling didn't work properly, and the navigationBar was full of images.In the same application, I apply images from asset catalog to regular UIButton, but it is displayed normally, so I think it is only a problem with barbuttonitem.
Do I need to fix something?
iOS11 UIBarButtonItem images not sizing-Stack Overflow
There was an answer on the above page.In short, in recent iOS, barButtonItem needs to be controlled by autolayout instead of frame.
© 2024 OneMinuteCode. All rights reserved.