NSArray *arr = [[NSArray alloc] initWithObjects:@"我发现你越来越不爱我了,只爱你的工作!",@"我怎么不爱你了?",@"我明天不吃饭了,去把你经理打一顿!",@"为什么打我经理?",@"呜你果然不爱我了!你都不问我为什么不吃饭..", nil];
CGFloat>20;
UILabel * label;
for (int>0; i<arr.count;> CGSize size =[arr[i] sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:CGSizeMake(200, 2000)];
if (i%2 ==0) {
label = [[UILabel alloc] initWithFrame:CGRectMake(5,high, size.width,size.height )];
label.text = arr[i];
label.backgroundColor = [UIColor yellowColor];
label.numberOfLines = 0;
[self.window addSubview:label];
}else{
label = [[UILabel alloc] initWithFrame:CGRectMake(315-size.width, high, size.width, size.height)];
label.text =arr[i];
label.backgroundColor = [UIColor greenColor];
label.numberOfLines = 0;
[self.window addSubview:label];
}
if (high+size.height>480) {
[label release];
break;
}
high += size.height + 5;
[label release];
}