您好,登錄后才能下訂單哦!
UILabel *tileLabel = [[UILabel alloc] init];
tileLabel.numberOfLines = 0;
tileLabel.backgroundColor = [UIColor clearColor];
tileLabel.text = @"調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭調(diào)整行間距云頭";
tileLabel.font = [UIFont systemFontOfSize:11.0f];
tileLabel.textColor = [Tools colorWithHex:0x787878];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:tileLabel.text];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:18];//調(diào)整行間距
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [tileLabel.text length])];
tileLabel.attributedText = attributedString;
NSDictionary *attributes = @{NSFontAttributeName:tileLabel.font, NSParagraphStyleAttributeName:paragraphStyle.copy};
CGFloat height = [tileLabel.text boundingRectWithSize:CGSizeMake(self.view.width-32, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attributes context:nil].size.height ;
// CGFloat height =[self changeStationWidth:tileLabel.text anWidthTxtt:self.view.width-32 anfont:11];
tileLabel.frame = CGRectMake(16, 0, self.view.width-32, height);
[self.view addSubview:tileLabel];
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。