UIImageView sizing problem

Hi there,

I’m trying to create a dropdown list with textfield and I’m currently trying to put a ‘down’ arrow on the right, here is the code.

let imgView = UIImageView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
let img = UIImage(named: "down")
imgView.image = downImg
selectBox.rightViewMode = .always
selectBox.rightView = imgView

although the image is displayed to screen, the size of the image does not fit with the UIView. Currently it looks like this.

Screen Shot 2020-01-03 at 11.18.37 am

I’ve tried changing the width and height of CGRect for a number of times but the size just refuses to change. Anyone has any idea about this problem?


Have you tried changing the property of the image?

hmmm yes but still doesn’t work

No worries I’ve deleted the image lol
Thanks for answering!