Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 529
Rahul Raj Avatar asked Apr 07 '12 19:04

Rahul Raj


1 Answers

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)
like image 96
miguel.de.icaza Avatar answered Oct 18 '22 13:10

miguel.de.icaza