标签:
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 80, kScreenWidth-20, 40)]; label.numberOfLines = 0; label.font = [UIFont systemFontOfSize:20]; label.text = @"服务员原指固定场所里提供一定范围内服务的人员,有男服务员,也有女服务员;现通常指旅馆、饭店、KTV、D厅等娱乐场所里,为客人提供必要服务的人员。服务员的基本职责是:迎接和招呼顾客;提供各种相应的服务;回答顾客的问询;为顾客解决困难;以最佳的情绪和态度对待顾客的各种不稳定情绪;及时处理顾客投诉,并给客人令人满意的答复。"; [self.view addSubview:label]; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:label.text];; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; [paragraphStyle setLineSpacing:5]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, label.text.length)]; label.attributedText = attributedString; //调节高度 CGSize size = CGSizeMake(label.bounds.size.width, 500000); CGSize labelSize = [label sizeThatFits:size]; CGRect frame = label.frame; frame.size = labelSize; label.frame = frame; label.backgroundColor = [UIColor redColor];
标签:
原文地址:http://blog.csdn.net/qishiai819/article/details/51364212