【发布时间】:2014-09-18 03:01:36
【问题描述】:
创建了一个 UILabel
lbl_Username = new UILabel {
Text = "Username",
Font = UIFont.FromName (DrugHub.Constants.K_HELVETIC_BOLD, KFontSize12),
};
// Frame the label
lbl_Username.Frame = new RectangleF (40, 20, 100, 12);
View.addSubView(lbw_Username.Frame);
如何设置框架宽度大小“自动”。大小适合文本内容。
当前使用用户名作为标签并设置 label.width = 100,
label.width需要根据Label.Text里面的内容设置自动调整。
@全部 提前致谢。
【问题讨论】:
-
发布问题后:: 我想出了答案。 lbl_Username.AttributedText.Size.Width.