iOS 文字下划线
设置UITextView,UILabel 中的文字加下划线
//添加下划线-(NSAttributedString*) getAttributedString:(NSAttributedString*) attributedString isUnderline:(BOOL) isUnderline{ NSNumber *valuUnderline = [NSNumbernumberWithBool:isUnderline]; NSRange rangeAll = NSMakeRange(0, attributedString.string.length); NSMutableAttributedString *as = [attributedString mutableCopy]; [as beginEditing]; [as addAttribute:NSUnderlineStyleAttributeNamevalue:valuUnderline range:rangeAll]; [as endEditing]; return as;}
使用
textView.attributedText = [self getAttributedString:_mainTextView.attributedText isUnderline:YES];label.attributedText = [self getAttributedString:_mainTextView.attributedText isUnderline:YES];
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。