2012-10-10 4 views
2

iOS 6 UITextView에서 일부 초기 텍스트의 글꼴 색을 설정하려고합니다. UI 6 시뮬레이터에서 실행하면 뷰가 표시되지만 특성은 렌더링되지 않습니다. 내가 놓친 게 있니?풍부한 UITextView (iOS 6)에 텍스트 속성이 표시되지 않습니다.

NSAttributedString *as = [[NSAttributedString alloc] initWithString:boilerText 
    attributes:[NSDictionary dictionaryWithObjectsAndKeys: 
     NSForegroundColorAttributeName, [UIColor redColor] , 
     NSUnderlineStyleAttributeName, 
      [NSNumber numberWithInt: NSUnderlineStyleSingle],nil] 
     ]; 

_descriptionView.attributedText = as; 

답변

8

이 메서드는 dictionaryWithObjectsAndKeys를 말합니다. 당신은 당신의 물건과 열쇠를 거꾸러 뜨 렸습니다. 사용해보기 :

NSAttributedString *as = [[NSAttributedString alloc] initWithString:boilerText 
    attributes:[NSDictionary dictionaryWithObjectsAndKeys: 
    [UIColor redColor], NSForegroundColorAttributeName, 
    [NSNumber numberWithInt: NSUnderlineStyleSingle], NSUnderlineStyleAttributeName, 
    nil]];