Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Custom renderers to give rounded corners in iOS

$
0
0

Hi.

I have written a custom renderer so that some labels have a gradient background and rounded corners. On the android version this was no problem. On iOS, I can do the gradient fill, but can't get the rounded corners. (Which I would have assumed would be the easier part.)

On the iOS I have overridden the Draw method, and this lets me draw a shape with a gradient fill to get my background.
I have been looking at this link
http://iosapi.xamarin.com/index.aspx?link=T%3AMonoTouch.UIKit.UIView
to try adding the rounded corners, but am unable to work out where to put the
view.Layer.CornerRadius = 4;

to get it to work.

Also tried overriding the OnElementChanged for this but couldn't get it to work in there either.

I've done Android for a while now, but this is my first iOS project, so I may well be missing something obvious.

Ian.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>