row*_*man 1 iphone uibutton ipad ios
我将图像文件添加到UIButton图像属性.但我的图像调整大小,看起来很难看.因此,如果我将我的图像添加到UIImageView,我可以将contentMode属性设置为UIViewContentModeAspectFit,图像看起来不错.但如果我对UIButton做同样的事情没有改变.
我的图像大于UIButton大小.但我不想调整它们的大小,因为我将它们用于iPhone和iPad.那么如何使用UIViewContentModeAspectFit将图像添加到UIButton?
有UIImageView 产权的UIButton
您可以访问它并可以像这样更改其模式:
UImageView *image = button.imageView;
Run Code Online (Sandbox Code Playgroud)
现在你可以调用这些方法
但请记住,您将设置UIImage使用
[button setImage:imag forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5015 次 |
| 最近记录: |