I upload some images from the API to my ios app and then display the images as the button background. Here is the code:
NSData *imageData = [r responseData]; UIImage *image = [UIImage imageWithData:imageData]; UIBlockButton *imageView = [UIBlockButton buttonWithType:UIButtonTypeCustom]; [imageView setBackgroundImage:image forState:UIControlStateNormal];
Here's the weird part. Vertical images (length shorter than height) will rotate 90 degrees when I press the button. Has anyone experienced this before / is this a bug?
Edit: my server sends images in a rotating state. Somehow UIButton knows to rotate it when it is not selected, but does not perform the same correction when I select it.
source share