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.text = @”Created uilabel programatically”;
[self.view addSubview:label];

Leave a Reply

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