in a label. - (void)viewDidLoad { [super viewDidLoad]; CGRect labelFrame = CGRectMake(20, 20, 280, 150); UILabel *myLabel = [[UILabel alloc] initWithFrame:labelFrame]; [myLabel setBackgroundColor:[UIColor orangeColor]]; NSString *labelText = @"Here is a long block of text that will probably wrap when put on a small screen."; [myLabel setText:labelText]; // Tell the label to use an unlimited number of lines [myLabel setNumberOfLines:0]; [myLabel sizeToFit]; [self.view addSubview:myLabel]; } From most popular iOS Stackoverflow question: http://bit.ly/topiosquestion
of text in a label. public override void ViewDidLoad() { base.ViewDidLoad(); RectangleF labelFrame = new RectangleF(20, 20, 280, 150); UILabel myLabel = new UILabel(labelFrame); myLabel.BackgroundColor = UIColor.Orange; myLabel.Text = "Here is a long block of text that will probably wrap when put on a small screen."; myLabel.Lines = 0; myLabel.SizeToFit(); View.AddSubview(myLabel); }
lines of text in a label. public override void ViewDidLoad() { // :P base.ViewDidLoad(); UILabel myLabel = new UILabel(new RectangleF(20, 20, 0, 0)) { BackgroundColor = UIColor.Orange, Text = "Here is a long block of text that will probably wrap when put on a small screen.", Lines = 0, }; myLabel.SizeToFit(); Add(myLabel); }
with Mono • 2003: Novell buys Ximian • 2009: MonoTouch released • 2011: ◦ April: MonoDroid [Mono for Android] released ◦ April: Attachmate buys Novell ◦ May: Attachmate lays off Novell ◦ May: Xamarin is born; announces future mobile products ◦ July: Xamarin given perpetual license to use MonoTouch and Mono for Android Worried about Apple + Xamarin? http://bit.ly/applelessevil
most of System.Whatever* ◦ Native APIs in C#-flavored syntax (same-day for new) ◦ Garbage Collection • Tools ◦ Xamarin Studio ◦ Xamarin Component Store *Some restrictions apply: http://bit.ly/xamarinioslimits