关于setBackgroundImage和setImage

UIButton设置图片既可以采用setBackgroundImage,也可以采用setImage方法。

 

不同点:

 setBackgroundImage:image会随着button的大小而自动拉伸来适应button的大小,设置button的title,image不会挡住title(因为是背景图片,图片在底部);

setImage:图片不会进行拉伸,原比例的显示在button上。此时再设置title,title将无法显示。

posted @ 2015-03-09 16:35  mikado_Q  阅读(361)  评论(0编辑  收藏  举报