Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView corners not rounded

I am using a UIWebView for displaying some formatted text. I am using the line:

sliderTextWebview.layer.cornerRadius = 10;

to round the corners of the UIWebview. The corners are not rounded but if you pull the text in the view down or up you can see the rounded corners of the UIWebView behind. It appears that the text frame sits above the web view background, but this frame's corners are not rounded.

like image 995
RGriffiths Avatar asked Oct 18 '25 19:10

RGriffiths


2 Answers

Try

sliderTextWebview.layer.masksToBounds = YES

For Swift 4+, it should be

sliderTextWebview.layer.masksToBounds = true
like image 64
foFox Avatar answered Oct 22 '25 04:10

foFox


These lines will help you out. Try these

sliderTextWebview.layer.cornerRadius = 10;
sliderTextWebview.layer.masksToBounds = YES;
like image 29
junaidsidhu Avatar answered Oct 22 '25 06:10

junaidsidhu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!