I want to set UILabel with multiline programatically in ios.Xamarin.
I have created UILabel this way and add it to my View below is the Code.
Code :
public override void ViewDidLoad()
{
base.ViewDidLoad();
var label = new UILabel();
label.Frame = new CoreGraphics.CGRect(10, 10, secondContainer.Frame.Size.Width - 20, 20);
label.Text = "First Label First Label First Label First Label First Label First Label";
label.Lines = 0;
label.LineBreakMode = UILineBreakMode.WordWrap;
secondContainer.AddSubview(label);
secondContainer.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.Height, NSLayoutRelation.GreaterThanOrEqual, null, NSLayoutAttribute.NoAttribute, 0, 20));
secondContainerHeight.Constant = label.Frame.Size.Height + 20;
}
but my label is not taking more than one Line.
Note :
this 2 property not working well
label.Lines = 0; label.LineBreakMode = UILineBreakMode.WordWrap;
I have tried search on google and SO but nothing is help me.
Any Help will be Appreciated.