Forum Xamarin.iOS

Using a custom font with a UILabel appears to change the background color of the label

GeorgeClingerman.9992GeorgeClingerman.9992 USMember
edited October 2013 in Xamarin.iOS

So I got custom fonts working and was super jazzed. Everything looked great...in the simulator. When I push to the device, all of my UILabels that use a custom font end up picking up the background color of the font color.

        RectangleF findAndBookLabelFrame = new RectangleF (new PointF(0, 0), new SizeF(this.View.Frame.Size.Width, 60));
        UILabel findAndBookLabel = new UILabel (){Text = titleText,Frame=findAndBookLabelFrame};
        findAndBookLabel.Font = UIFont.FromName("Proxima Nova",22f);
        findAndBookLabel.TextColor = UIColor.White;
        findAndBookLabel.TextAlignment = UITextAlignment.Center;
        topBackground.AddSubview (findAndBookLabel);

In the simulator this looks great. The text is shown white and the labels background color remains clear like I would expect. However when I push it to the device, the background color picks up the text color and the label in the example above is a solid white color.

I have to add the following line

        findAndBookLabel.BackgroundColor = UIColor.Clear;

To get the label to behave properly on the device. This is an ok workaround, I'm just wondering if there's something I'm doing incorrectly or if this is a known bug?

Sign In or Register to comment.