기본 콘텐츠로 건너뛰기

라벨이 attributedString인 게시물 표시

Xcode Log - Label / Attributed Text - Replace

        let mutableString: NSMutableString = ( resultLabel . attributedText as ! NSMutableAttributedString ). mutableString         mutableString. replaceOccurrencesOfString ( "@1" , withString: "109" , options:  NSStringCompareOptions .LiteralSearch , range: NSMakeRange ( 0 , mutableString. length )) 결국 이 두 줄의 코드. AS3 할때도 이런 경우가 있었는데  HTML 형식으로 formatting한 label을 다룰때 생각보다 간단하지 않았다. 물론 해결하고 나니 속 시원했었지만. 이게 다 저 @1 부분을 replace 하려고 시작한 일이었다. 조금 더 다양한 가능을 보려고 손을 좀 더 보았다. Xcode 에서 이걸 직접 살펴보았다.                                 <attributedString key = "attributedText" >                                     <fragment content = " 이거이 사람이 할 짓이 아닌가 봅니다 . " >           ...