相关疑难解决方法(0)

UIButton不听内容模式设置?

firstButton是Custom类型的UIButton.我以编程方式将三个放在一个表的每个单元格中,因此:

[firstButton setImage:markImage forState:UIControlStateNormal];
[firstButton setContentMode:UIViewContentModeScaleAspectFit];
[cell.contentView addSubview:firstButton];
Run Code Online (Sandbox Code Playgroud)

在其他地方,我告诉它clipToBounds.我得到的是图像中心方块的裁剪,而不是它的纵横比例渲染.我已经尝试了很多方法,包括在firstButton.imageView上设置mode属性,这似乎也不起作用.

uibutton contentmode ios

89
推荐指数
6
解决办法
5万
查看次数

标签 统计

contentmode ×1

ios ×1

uibutton ×1