iOS & Swift

attributedText 의 몇가지 예

그리다웍스 2015. 6. 24. 16:56

돌아서면 잊어버리는 것들을 몇가지 적어본다.

1)

// range 의 범위는 표현하고자 하는 케이스마다 적절하게 수정한다.


NSRange range;

range.location = [문자열 length];

range.length = 1;    // 얼마나 적용할것인지




            

NSMutableAttributedString *attributedString = [[NSMutableAttributedString allocinitWithString:문자열];

            

[attributedString addAttribute:NSFontAttributeName

                         value:[UIFont boldSystemFontOfSize:12.0f]

                         range:range];

            

self.label.attributedText = attributedString;


2)

// 취소선

    [attributeString addAttribute:NSStrikethroughStyleAttributeName

                            value:@(NSUnderlineStyleSingle)

                            range:range];


'iOS & Swift' 카테고리의 다른 글

XCode 에서 Provisioning profile 삭제하기  (0) 2016.03.18
오픈 소스 몇가지  (0) 2015.09.02
ioS 링크 모음  (0) 2015.06.09
Push 가능한 Dev 버전 ipa 생성  (0) 2015.04.22
objective-c 에서 static constant 의 정의  (0) 2015.02.06