How to create uilabel programatically in iphone development

here is sample code for creating UILabel programatically

UILabel  * label = [[UILabel alloc] initWithFrame:CGRectMake(40, 30, 300, 50)];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter; // UITextAlignmentCenter, UITextAlignmentLeft
label.textColor=[UIColor whiteColor];
label.numberOfLines=0;
label.lineBreakMode=UILineBreakModeWordWrap;
label.text = @”Created uilabel programatically”;
[self.view addSubview:label];

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *