iOS/Objective C
NSString UILabel 밑줄 긋기
CoCoE
2016. 2. 4. 16:00
- (void) setUnderLine:(UILabel*)label
{
//글자 세팅
NSString* str = @"Hello World";
NSMutableAttributedString* attStr = [[NSMutableAttributedString alloc] initWithString:str];
NSRange range1 = [str rangeOfString:@"Hello"];
//밑줄 긋기
[attStr addAttributes:@{NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle), NSUnderlineColorAttributeName:[UIColor greenColor]} range:range1];
[label setAttributedText:attStr];
}
굵은 = NSUnderlineStyleThick