I have a problem with UIButton image if I set its imageView contentMode to 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];
The image inside button is properly scaled to fill the whole button area.
After a click/touch on button the image gets resized (flickers) like if it's contentMode is set to UIViewContentModeScaleAspectFit
.
Does anyone know how to remove this flickering when click/touch occurs?
Thanks!