Why does a selected image overflow the button border in swift?

265 views Asked by At

enter image description here

I am trying to create a profile image selection button. However, every time I select an image with UIImagePickerController, the image overflows the bottom of the button border. Is there a way to make sure the image stays within the border

2

There are 2 answers

0
Jawad Ali On BEST ANSWER

Set buttons clip to bounds true

button.clipsToBounds = true
0
Heeba Khan On

Select clipToBounds from attributes section, or add button.clipsToBounds = true . Try using Autofit as well. it is also available in attribute section on storyboard.