I add an image file to to UIButton image property. But my image resized and looks ugly. So if I’ll added my image to UIImageView, I can set contentMode property to UIViewContentModeAspectFit and image will look nice. But if I’ll do the same for UIButton nothing changed.
My images large than UIButton size. But I don’t want to resize them because I use them for iPhone and iPad.
So how can I add image to UIButton with UIViewContentModeAspectFit?
I add an image file to to UIButton image property. But my image resized
Share
There is
UIImageViewproperty of theUIButtonyou can access it and can change its mode like this:
now you can call the methods
but remember you will set the
UIImageusing