如果我将 UIButton 图像的 imageView contentMode 设置为UIViewContentModeScaleAspectFill
.
UIButton *imageButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
imageButton.imageView.contentMode = UIViewContentModeScaleAspectFill;
[imageButton setImage:[UIImage imageNamed:@"myImage.jpg"] forState:UIControlStateNormal];
[imageButton addTarget:self action:@selector(doSmth:) forControlEvents:UIControlEventTouchUpInside];
按钮内的图像已正确缩放以填充整个按钮区域。
单击/触摸按钮后,图像会调整大小(闪烁),就像它的 contentMode 设置为UIViewContentModeScaleAspectFit
.
有谁知道点击/触摸发生时如何消除这种闪烁?
谢谢!