UIButton图像和背景图像,哪一个用于自定义图像? [英] UIButton image and background image, which one to use for custom image?

查看:88
本文介绍了UIButton图像和背景图像,哪一个用于自定义图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自定义我的UIButton,我可以设置图像或背景图像。它们都工作正常,但我如何决定使用哪一个?当人们将图像分解为前景和背景以便它们可以分层时这两种方法吗?

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?

推荐答案

背景缩放图像以填充UIButton的边界,并在后面显示标题。前景图像未缩放,并显示 next 到按钮标题。

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.

这篇关于UIButton图像和背景图像,哪一个用于自定义图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆