I want to add as many labels as objects in my array. but how to align them??.i want one below the other,and id the page is done it should start in the next column.but with the code i tried its overriding the other.
- (void)viewDidLoad
{
[super viewDidLoad];
array = [[ NSMutableArray alloc]initWithObjects:@"aaa",@"bbb",@"ccc",@"ddd",nil];
for( int i=0;i<[array count];i++)
{
NSString *theText = [array lastObject];
UILabel *label = [[UILabel alloc]init];
label.text = theText;
label.backgroundColor = [UIColor clearColor];
label.lineBreakMode = UILineBreakModeWordWrap;
label.frame = CGRectMake(0, label.frame.origin.y + label.frame.size.height, size.width + 20, size.height + 20);
[self.view addSubview:label];
}
}
try this code..