UILabel换行

直接上代码:

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(42, 3, 250, 30 )];         [label setBackgroundColor:[UIColor clearColor]];         [label setFont:[UIFont fontWithName:@"ArialMT" size:12]];         [label setTextColor:[UIColor colorWithRed:255 green:255 blue:255 alpha:1]];         [label setText:photo.title];         [label setNumberOfLines:0];//换行需要设置         [label setLineBreakMode:UILineBreakModeWordWrap];//换行需要设置

你可能感兴趣的:(UILabel换行)