Asset Catalog image applied to BarButtonItem does not scale

Asked 2 years ago, Updated 2 years ago, 29 views

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?

ios

2022-09-29 21:41

1 Answers

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.


2022-09-29 21:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.