如何在monotouch中更改UI按钮文本的大小?

Rah*_*Raj 6 objective-c uikit xamarin.ios ios

我试过了代码

UIbutton *bt = new UIbutton;
bt.Font = UIFont.SystemFontSize(35);
Run Code Online (Sandbox Code Playgroud)

但我不断收到编译错误"由于保护级别,字体大小无法访问".任何解决方法?

mig*_*aza 6

错误消息远非理想,但是SystemFontSize返回float的属性,而不是返回a的方法UIFont.

为此你想要:

UIButton button = UIButton.FromType (UIButtonType.RoundedRect);
bt.Font = UIFont.SystemFontOfSize (35)
Run Code Online (Sandbox Code Playgroud)