1
[self addAttribute:(__bridge NSString*)kCTForegroundColorAttributeName value:(__bridge id)color.CGColor range:range];
這是完整的方法代碼。
-(void)setTextColor:(UIColor*)color range:(NSRange)range
{
if (range.location != NSNotFound) {
// kCTForegroundColorAttributeName
[self removeAttribute:(__bridge NSString*)kCTForegroundColorAttributeName range:range]; // Work around for Apple leak
[self addAttribute:(__bridge NSString*)kCTForegroundColorAttributeName value:(__bridge id)color.CGColor range:range];
}}
我試過如果沒有找到範圍,但仍然發生錯誤。任何提示或建議我做錯了什麼?