UILabel label = new UILabel(); label.Frame = new CGRect(20, 50, 200, 50); // position and size of label label.Text = "Hello World!"; // set label text Add(label); // add label to view
UILabel label = new UILabel(); label.Frame = new CGRect(20, 50, 200, 100); // position and size of label label.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor."; label.Lines = 0; // set number of lines to be auto-calculated based on text label.Font = UIFont.SystemFontOfSize(16); // set font size label.TextColor = UIColor.DarkGray; // set text color Add(label); // add label to viewIn C#, UILabel is a part of the Xamarin.iOS package library, which provides a set of libraries, tools, and APIs for developing iOS applications using C#.