Hello,
I want to add UILabel controls to my application dynamically from code (programmatically), please help me
Hello,
I want to add UILabel controls to my application dynamically from code (programmatically), please help me
You can do it the following way in one of the view controller methods:
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(...)]; // Create UILabel
myLabel.tag = someTag; // set label's tag to access this label in future via [view viewWithTag:someTag];
... // set label's properties like text, background and text color, font size etc (e.g. myLabel.textColor = [UIColor redColor];)
[view addSubView:myLabel]; // add label to your view
[myLabel release]; // view owns the label now so we can release it