Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to apply bold and italics for the applied custom font in the UILabel?

EswaranEswaran INMember ✭✭

For the UILabel I have applied a custom font and i tried to apply bold and italics for that custom font. But I am unable to achieve it. For default font i am able to achieve it but for custom font i couldn't. Is it possible to achieve it. The code snippet is provided below:

UILabel uILabel = new UILabel();
uILabel.Text = "MyText";
uILabel.Frame = new CGRect(10, 50, 350, 40);
uILabel.Font = UIFont.FromName("Handlee", 15);
UIFontDescriptor descriptor = uILabel.Font.FontDescriptor.CreateWithTraits(UIFontDescriptorSymbolicTraits.Bold);
if (descriptor != null)
uILabel.Font = UIFont.FromDescriptor(descriptor, 30);

I have also attached the sample.

Sign In or Register to comment.