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

Label Custom Renderer unable to make it work on iOS

$
0
0

I've created a custom renderer for a label and works fine on Android.
I am now trying to make it work on iOS but nothing happens, the label never changes.

Here is what I've tried:

public class LabelMonospace_iOS:LabelRenderer
{
    protected override void OnElementChanged (ElementChangedEventArgs<Label> e)
    {
        base.OnElementChanged (e);

        if (Control != null) {   // perform initial setup
            Control.Font = UIFont.FromName ("Helvetica", 32f);
            Control.TextColor = UIColor.Cyan;
        }

        LabelMonospace el = (LabelMonospace)this.Element;
        var labelTextField = (UILabel)Control;
        labelTextField.TextColor = UIColor.Magenta;

    }
}

I am exporting it with
[assembly: ExportRenderer (typeof (LabelMonospace), typeof (LabelMonospace_iOS))]

I am using Xamarin Forms 1.3

Any hint? thank you.


Viewing all articles
Browse latest Browse all 75885

Trending Articles



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