배열의 모든 범위 색상을 설정하려고하는데이 오류가 발생합니다. 나는 왜 그런지 이해하지 못한다. 범위가 모두 유효합니다. 나는 수동으로 범위를 테스트 해 보았습니다. 고맙습니다.NSMutableAttributedString - NSForegroundColorAttributeName
CGContextSetFillColorWithColor : 유효하지 않은 컨텍스트 0x0으로
NSMutableAttributedString * string = [[NSMutableAttributedString alloc] initWithString:tv.text];
for (NSString * s in array) {
[string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSRangeFromString(s)];
}
CATextLayer *textlayer = [[CATextLayer alloc]init];
textlayer.frame = CGRectMake(0, 0, 320, 480);
[self.view.layer addSublayer:textlayer];
textlayer.string = @"aString"; //works
textlayer.string = string; //does not work
tv.text = @"";
오류 : 그것은 선언되지 않은 식별자 "kCTForegroundColorAttributeName"의 사용을 말합니다 ... 프레임 워크 ??? – BDGapps
핵심 텍스트를 잊어 버렸습니다. 감사합니다 – BDGapps
좋은. 따라서 유효하지 않은 컨텍스트 오류가 사라졌습니다. 'NSForegroundColorAttributeNameis'을 사용할 때 컴파일 되었습니까? hmm –