UILabel垂直方向显示(上下的顺序显示)。
NSString* text = @"一";
NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:16]};
CGSize size = [text boundingRectWithSize:CGSizeMake(1000, 90) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute context:nil].size;
CGFloat w = size.width+2;//一个汉字的宽度加2 ,要不然会显示残缺
text = @"如题,我们平时习惯的用法是将text以左右顺序呈现在UILabel上,那么有什么方法能让text以上下的顺序显示呢? ";
// CGSize asize = [text sizeWithFont:font constrainedToSize:CGSizeMake(w, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
//老的方法已经弃用了。
CGSize asize = [text boundingRectWithSize:CGSizeMake(w, MAXFLOAT) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:attribute context:nil].size;
CGFloat h = asize.height;
UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(100,10,w,h)];
lable.text = text;
lable.numberOfLines = 0;
[self.view addSubview:lable];