How can I make the borders to be a little bit more away from the image and not be directly attached to it like you can see at the screenshot
Asked
Active
Viewed 210 times
0

Federica Benacquista
- 835
- 11
- 25
-
7Possible duplicate of [How do I make an UIImage/-View with rounded corners CGRect (Swift)](https://stackoverflow.com/questions/25476139/how-do-i-make-an-uiimage-view-with-rounded-corners-cgrect-swift) – Robert Dresler Apr 02 '19 at 16:27
3 Answers
1
In order to have rounded corners you have to set
imageView.layer.cornerRadius = 9 //Or any other number
In order to make the borders further from the borders just change your constraints' values.

Federica Benacquista
- 835
- 11
- 25
-
I suppose OP knows about this since he calls method called `roundImage()`. Anyway, question is very unclear and problem is probably connected with mask to bounds / clips to bounds set to `false` instead of `true` – Robert Dresler Apr 02 '19 at 19:00
-
-
https://stackoverflow.com/a/39466262/10408872 check this link let me know if it helps.. – Federica Benacquista Apr 03 '19 at 09:35
0
Try this
imageView.layer.cornerRadius = 10
imageView.layer.masksToBounds = true

Santosh
- 363
- 2
- 14
-
-
Here is detail information about it. https://developer.apple.com/documentation/quartzcore/calayer/1410896-maskstobounds – Santosh Apr 03 '19 at 02:56
-
0
I don't know if I understand the question correctly but you might be looking for something like:
imageView.contentMode = .scaleAspectFit

Axort
- 2,034
- 2
- 23
- 24