UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,0,0)];//后面还会重新设置其size。
[label setNumberOfLines:0];NSString *s = @"string......";UIFont *font = [UIFont fontWithName:@"Arial" size:12];CGSize size = CGSizeMake(320,2000);CGSize labelsize = [s sizeWithFont:font constrainedToSize:sizelineBreakMode:UILineBreakModeWordWrap];[label setFrame:CGRectMake(0, 0, labelsize.width, labelsize.height)];[self.view addSubView:label];引用: