Rahul Raj
Rahul Raj

Reputation: 367

How to change the size of the text of UIbutton in monotouch?

I tried the code

UIbutton *bt = new UIbutton;
bt.Font = UIFont.SystemFontSize(35);

But I keep getting a compilation error "Font size is inaccessible due to protection level." Any workaround?

Upvotes: 6

Views: 2417

Answers (1)

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

The error message is far from ideal, but SystemFontSize is property that returns a float, not a method that returns a UIFont.

For that you want:

UIButton button = UIButton.FromType (UIButtonType.RoundedRect);
bt.Font = UIFont.SystemFontOfSize (35)

Upvotes: 6

Related Questions