我创建了一个按钮的网格。以下代码创建按钮并显示它们,但按钮上没有文本。有没有我失踪的设置? (OBJ - C的答复都很好,我很双语)iPhone/iPad的UIButton TitleLabel文本没有出现
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);
你为什么使用大写字母titleLabel?它是button.titleLabel,而不是按钮。** T ** itleLabel。 – 2015-11-04 13:05:23
我已经详细解释了这里http://stackoverflow.com/a/11417134/1149906 – 2016-06-07 06:37:15