简体   繁体   中英

iOS resizableImageWithCapInsets & @2x, @3x images

I am creating a 'chat bubble' using this method, by setting the background image after calling resizableImageWIthCapInsets . However, for this method you need to hardcode the cap insets by pixel, but the pixel size is different for each 1x, 2x, and 3x image size. How do I get around this issue? Is there a way to know which image the device is using (the 1x, 2x, or 3x)?

You don't need to do it in code. Xcode has a special tool for this. Check this link , in the section named "CAN I GET THOSE IMAGES FOR THESE BUTTONS, BUT LONGER?" or here . There are explanations how to use it.

If you use this you can not care if image is ready to display or which resolution you should use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM