setBackgroundImage 和 setImage的区别

简介: setBackgroundImage 和 setImage的区别

关于UIButton,既可以采用setBackgroundImage 来设置底部图片,同时也可以采用  setImage方法;


两者还是有一定区别的;


首先setBackgroundImage,image会随着button的大小而改变,图片自动会拉伸来适应button的大小,这个时候任然可以设置button的title,image不会挡住title;

相反的的setImage,图片不会进行拉伸,原比例的显示在button上,此时再设置title,title将无法显示,因此可以根据需求选中方法;

目录
相关文章
|
16天前
|
存储 前端开发 JavaScript
for...in、for...of、for...Each的详细区别!
for...in、for...of、for...Each的详细区别!
|
3月前
|
SQL 安全 Java
myabtis中#{} 和 ${} 的区别是什么
myabtis中#{} 和 ${} 的区别是什么
|
8月前
|
索引
for each和for of的区别
for each和for of的区别
|
9月前
#{} 和 ${} 的区别是什么?
#{} 和 ${} 的区别是什么?
36 0
||、&&、!的使用与区别
||、&&、!的使用与区别
59 0
|
安全
s=s+1,s+=1,++1,1++没有区别?
s=s+1,s+=1,++1,1++没有区别?
|
算法 编译器 Linux
C与C++的区别
C与C++的区别
93 0
|
JSON 数据格式
for...in/for...each/for...of的区别
for...in/for...each/for...of的区别
103 0
for...in/for...each/for...of的区别
backgroundColor与 tintColors的区别
backgroundColor与 tintColors的区别
92 0
backgroundColor与 tintColors的区别
|
存储 前端开发 Java
@SessionAttributes 和 @SessionAttribute的区别
@SessionAttributes 和 @SessionAttribute的区别