0

什么原因,为什么这段代码在 IOS7 中不起作用?我正在尝试设置颜色,但颜色不会改变,它保持黑色:

NSDictionary *attributes = [NSDictionary dictionaryWithObject:[UIColor redColor] forKey:NSForegroundColorAttributeName];
NSAttributedString *subString = [[NSAttributedString alloc] initWithString:@"abc" attributes:attributes];

UITextView *textView = ....

textView.attributedText = subString;
4

1 回答 1

0

使用这个我相信它可以工作,因为我已经测试过

    NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], NSForegroundColorAttributeName, nil];
    NSAttributedString *subString = [[NSAttributedString alloc] initWithString:@"abc" attributes:attributes];
于 2013-10-07T07:21:11.503 回答