그러나, 나는 오류 조금이라도 문제가 있으면 설정된 메시지가 출시 된 개체로 전송되고있는 것으로 보입니다. 디버거를 사용하여, 나는 CTFontRef 인 것으로 보이는 po'd 0x200020e0을가집니다.(NSCFType 세트) 아이폰 OS에서 인식 할 수없는 선택 (6) 내가 아이폰 OS 6에서 아이폰 OS 5에서 잘 작동 큰 TTTAttributedLabel (<a href="https://github.com/mattt/TTTAttributedLabel" rel="noreferrer">https://github.com/mattt/TTTAttributedLabel</a>)를 사용하고
https://github.com/mattt/TTTAttributedLabel
그 코드 : 여기에 사용 예에서와 같이
[label setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^ NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
NSRange boldRange = [[mutableAttributedString string] rangeOfString:title options:NSCaseInsensitiveSearch];
NSRange strikeRange = [[mutableAttributedString string] rangeOfString:@"sit amet" options:NSCaseInsensitiveSearch];
UIFont *boldSystemFont = [UIFont boldSystemFontOfSize:20];
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)boldSystemFont.fontName, boldSystemFont.pointSize, NULL);
if (font) {
[mutableAttributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:boldRange];
[mutableAttributedString addAttribute:(NSString*)kCTForegroundColorAttributeName value:(__bridge id)font range:boldRange];
CFRelease(font);
}
return mutableAttributedString;
}];
:
po 0x200020e0
(int) $0 = 536879328 CTFont <name: .HelveticaNeueUI-Bold, size: 20.000000, matrix: 0x0>
CTFontDescriptor <attributes: <CFBasicHash 0x20001900 [0x3c2a4100]>{type = mutable dict, count = 1,
entries =>
1 : <CFString 0x3be2a768 [0x3c2a4100]>{contents = "NSFontNameAttribute"} = <CFString 0x3c292c14 [0x3c2a4100]>{contents = ".HelveticaNeueUI-Bold"}
은}
이것은 TTTAttributedLabel을 설정하는 코드에 직선 저를 주도 ARCified가 아니므로 브리지 된 캐스트를 추가했습니다 (위 참조). 나는 그 곳곳에 머무르려고했으나 CTFontRef가 너무 일찍 릴리스되는 이슈 (그럴 것으로 보입니다)를 해결하지 못하는 것 같습니다 (제 생각에는 - 다른 제안이 환영합니다).
이 문제를 해결하는 방법에 대한 아이디어와 iOS 6 시뮬레이터에서이 작업을 수행하는 이유는 무엇입니까? 미리 감사드립니다.
죄송합니다, 거기에 편집이별로 의미가 없다는 것을 알았습니다. 어떤 키를 의미하는지 기억이 나지 않지만 상황에 따라 알아낼 수 있습니다. 기본적으로 사용되지 않는 키는 사용하지 마십시오! – CMash