Answer the question
In order to leave comments, you need to log in
How to round UIView?
Hello, friends!
Faced a problem, could you explain to me how to round the UIView? What am I doing wrong in the code and how should I do it right? Please explain your answer so that I can understand and understand the whole point in the future.
Inside the UIView is a Button with a background image.
I want to achieve this effect:
Answer the question
In order to leave comments, you need to log in
view.layer.masksToBounds = true
Oh, and you're doing it in the wrong place. At the time your code is called, the images don't have their actual dimensions.
Move the rounding at least in viewDidApear, or better in viewDidLayoutSubviews
What are these methods and what to do in them can be found here -> CLICK
And a little more here -> CLICK
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question