2013-09-27 2 views

답변

1

불행히도 그렇습니다.

C4Label은 원래 iOS5가 출시 될 때 설계되었으며 iOS6이 출시 될 때 수정이 필요하지 않았습니다 ... iOS6 이전에는 속성 문자열 사용이 UILabel에서 불가능했습니다. C4Label은 본질적으로 UILabel의 인스턴스를 래핑하므로 속성 문자열 사용에 직접 액세스 할 수 없었습니다.

-(void)setup { 
    //Create a label 
    C4Label *l = [C4Label labelWithText:@"this is kerning"]; 
    l.numberOfLines = 2; 

    //Create a key 
    NSString *kernKey = (NSString *)kCTKernAttributeName; 
    //Create a value 
    NSNumber *kernValue = @20; 
    //Create an attributed string 
    NSMutableAttributedString *attStr = [NSMutableAttributedString new]; 
    //set the attributed string with the text, using the value as a dictionary 
    attStr = [attStr initWithString:l.text attributes:@{kernKey:kernValue}]; 

    //set and center the text 
    l.label.attributedText = attStr; 
    l.textAlignment = ALIGNTEXTCENTER; 

    //resize and position the frame 
    l.frame = CGRectMake(0,0,320, 80); 
    l.center = self.canvas.center; 

    [self.canvas addLabel:l]; 
} 

C4Label은 현대화에 대한 목록에 있지만 아직에 입수되지 않았습니다

는 그러나 C4Label 랩을 부여 UILabel는 다음과 같은 방법으로 커닝을 추가 할 수 있습니다.

관련 문제