国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS中UILabel text兩邊對齊的實現代碼

2020-07-26 02:59:07
字體:
來源:轉載
供稿:網友

廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:

-(NSAttributedString *)setTextString:(NSString *)text{  NSMutableAttributedString *mAbStr = [[NSMutableAttributedString alloc] initWithString:text];  NSMutableParagraphStyle *npgStyle = [[NSMutableParagraphStyle alloc] init];  npgStyle.alignment = NSTextAlignmentJustified;  npgStyle.paragraphSpacing = 11.0;  npgStyle.paragraphSpacingBefore = 10.0;  npgStyle.firstLineHeadIndent = 0.0;  npgStyle.headIndent = 0.0;  NSDictionary *dic = @{             NSForegroundColorAttributeName:[UIColor blackColor],             NSFontAttributeName      :[UIFont systemFontOfSize:15.0],             NSParagraphStyleAttributeName :npgStyle,             NSUnderlineStyleAttributeName :[NSNumber numberWithInteger:NSUnderlineStyleNone]             };  [mAbStr setAttributes:dic range:NSMakeRange(0, mAbStr.length)];  NSAttributedString *attrString = [mAbStr copy];  return attrString;}NSString* const msg = @"6日,“幼兒園老師讓帶一條魚”的微博突然間就火了!占領朋友圈!征服全國網友.圖片甚至遭網友惡搞:水煮魚、生魚片都出來了。1月7日,記者在茫茫人海之中,歷經千辛萬苦終于在浙江慈溪找到了這位被網友吐槽的“粗心”家長!來聽聽他的解釋吧";self.lbView.attributedText = [self setTextString:msg];

以上所述是小編給大家介紹的iOS中UILabel text兩邊對齊的實現代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 镶黄旗| 永修县| 大田县| 沈阳市| 凌源市| 石楼县| 蕉岭县| 湖州市| 清河县| 德化县| 当涂县| 长垣县| 桐柏县| 普兰店市| 徐州市| 宁都县| 涡阳县| 调兵山市| 衡山县| 砀山县| 大兴区| 榕江县| 嘉祥县| 香港| 出国| 温泉县| 阳曲县| 兴宁市| 岚皋县| 班玛县| 衡水市| 鄄城县| 东兰县| 蒙阴县| 西乌珠穆沁旗| 茶陵县| 中西区| 淳化县| 八宿县| 称多县| 调兵山市|