UILabel文字竖排
方法一:
UILabel *mindName = [[UILabel alloc]initWithFrame:kCR(0, 0, 25,40)]; mindName.text = @"苏\n小\n明"; mindName.numberOfLines = [mindName.text length];
方法二:
// NSString *text = @"一"; // NSString *strText = @"苏得强"; // UIFont *font = [UIFont systemFontOfSize:12]; // CGSize sizeWord = [text sizeWithFont:font constrainedToSize:CGSizeMake(320, 2000.0) lineBreakMode:UILineBreakModeWordWrap]; // CGFloat w = sizeWord.width;//一个汉字的宽度 // CGSize sizeStr = [strText sizeWithFont:font constrainedToSize:CGSizeMake(w, 2000.0) lineBreakMode:UILineBreakModeWordWrap]; // CGFloat h = sizeStr.height; // // UILabel *aLabel = [[UILabel alloc]initWithFrame:kCR(0, 0, w, h)]; // aLabel.text = strText; // aLabel.backgroundColor = [UIColor clearColor]; // aLabel.textColor = [UIColor whiteColor]; // aLabel.numberOfLines = 0; // [aView addSubview:aLabel];