2010-04-25 3 views
1

iPhone에서 텍스트를 쉽게 구분할 수있는 간단한 방법이 있는지 알고 싶습니다.iPhone - NSString을 치십시오.

감사

+0

즉, 이러한 정보를 저장하기 위해 NSAttributedString은을 사용할 수 있습니다 UILabel을 사용하거나,'-drawRect :'에 NSString을 그리기? – kennytm

답변

2

예와 아니오,

있는 NSString가 만 저장 서식 화되어 있지 않은 텍스트 간단한 클래스이지만

NSAttributedString* italicText = [[NSAttributedString alloc] initWithString:myNsString attributes:myCrossOutAttributes]; 
+0

참고 : NSAttributedString은 3.2 이상에서만 사용할 수 있습니다. – kennytm

+0

shoot ... 3.0 용으로 개발하면 파업을 할 수 없습니까? – ncohen

+1

아니요, NSAttributedString을 사용하지 않습니다. 그러나 UILabel을 서브 클래스 화하고 -drawRect :에 사용자 정의 도면 코드를 추가 할 수 있습니다. KennyTM와 같이 말입니다. – Rengers

3
NSMutableAttributedString *strikeThroughString = [[NSMutableAttributedString alloc] initWithString:anyString]; 
[strikeThroughString addAttribute:NSStrikethroughStyleAttributeName value:(NSNumber *)kCFBooleanTrue range:NSMakeRange(0, [as length])]; 
[m_cObjTaskTitle setAttributedText:strikeThroughString =]; 
cObjTaskTitle = UILabel ; 
관련 문제