Reputation: 4409
Created a 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);
How to set frame width size "auto". Size to fit on text content.
currently using Username for label and set label.width = 100,
label.width need to set automatically adjust according to content inside the Label.Text.
@All Thanks In advance.
Upvotes: 1
Views: 1169
Reputation: 1415
CGSize size = [string sizeWithAttributes:
@{NSFontAttributeName:
[UIFont systemFontOfSize:17.0f]}];
Replacement for deprecated sizeWithFont: in iOS 7?
Dynamically resize label in iOS 7
this link help you.
Upvotes: 1