UIButton image and background image, which one to use for custom image?

☆樱花仙子☆ 提交于 2019-12-20 16:22:37

问题


I am customizing my UIButton and I can either set image or background image. They both work fine but how do I decide which one to use? Are these two methods for when people have image that are broken up into foreground and background so they can layer them?


回答1:


The background image is scaled to fill the bounds of the UIButton, and is displayed behind the title. The foreground image is not scaled, and displayed next to the button title.

So if you want to put a title on your button, use the background image.




回答2:


The background image serves for you to customize the "button image", the common background that all your buttons will take. The button image itself will lay on top of the background image and you can use to add, e.g., a small icon to further decorate the contents of the button.



来源:https://stackoverflow.com/questions/1309977/uibutton-image-and-background-image-which-one-to-use-for-custom-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!