iPhone/iPad UIButton TitleLabel 文本未出现 [英] iPhone/iPad UIButton TitleLabel text not appearing
本文介绍了iPhone/iPad UIButton TitleLabel 文本未出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个按钮网格.以下代码创建按钮并显示它们,但按钮上没有文本.有没有我遗漏的设置?(Obj-C 回复很好,我是双语的)
I created a grid of buttons. The following code creates the buttons and displays them, but there is no text on the button. Is there a setting I am missing? (Obj-C replies are fine, I'm bi-lingual)
RectangleF frame = new RectangleF (X + 3, Y + 3, cellWidth - 2, cellHeight - 2);
UIButton button = new UIButton (frame);
button.TitleLabel.Text = "Baha'i";
button.TitleLabel.Font = UIFont.FromName ("Helvetica-Bold", 15);
button.TitleLabel.TextColor = UIColor.Black;
button.TitleLabel.Frame = frame;
button.BackgroundColor = UIColor.FromWhiteAlpha(.5f,.5f);
this.AddSubview (button);
推荐答案
我想你想要 setTitle: forState:
[button setTitle:@"Baha'i" forState:UIControlStateNormal]
这篇关于iPhone/iPad UIButton TitleLabel 文本未出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文