如何 set/change UIBarButtonItem 的标题字体大小
How can I set/change the font size of UIBarButtonItem's Title
这是我做的例子
self.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(Title:"want to let this text be smaller", UIBarButtonItemStyle.Plain, (object sender, EventArgs e) => webView.EvaluateJavascript ("window.location.href=")), true);
试了很多方法都没有解决这个问题
试试这个:
var button = new UIBarButtonItem("want to let this text be smaller", UIBarButtonItemStyle.Plain, (object sender, EventArgs e) => webView.EvaluateJavascript ("window.location.href="));
var fontAttribute = new UITextAttributes();
fontAttribute.Font = UIFont.SystemFontOfSize(8);
button.SetTitleTextAttributes(fontAttribute, UIControlState.Normal);
NavigationItem.SetRightBarButtonItem(button, true);
这是我做的例子
self.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(Title:"want to let this text be smaller", UIBarButtonItemStyle.Plain, (object sender, EventArgs e) => webView.EvaluateJavascript ("window.location.href=")), true);
试了很多方法都没有解决这个问题
试试这个:
var button = new UIBarButtonItem("want to let this text be smaller", UIBarButtonItemStyle.Plain, (object sender, EventArgs e) => webView.EvaluateJavascript ("window.location.href="));
var fontAttribute = new UITextAttributes();
fontAttribute.Font = UIFont.SystemFontOfSize(8);
button.SetTitleTextAttributes(fontAttribute, UIControlState.Normal);
NavigationItem.SetRightBarButtonItem(button, true);