创建了一个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内的内容自动调整 .
@All先谢谢 .
1 回答
Replacement for deprecated sizeWithFont: in iOS 7?
Dynamically resize label in iOS 7
Dynamically getting height of UILabel according to Text return different Value for iOS 7.0 and iOS 6.1
这个链接可以帮到你 .