Я вставляю NSAttributedString в NSTableView, и в зависимости от его содержимого я добавляю атрибуты в его словарь стилей.
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
NSAttributedString *theValue;
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
[attributes setObject:[NSFont systemFontOfSize:11] forKey:NSFontAttributeName];
currentObject = [ticketsDataSource objectAtIndex:rowIndex];
if ([[currentObject valueForKey:aTableColumn.identifier] isKindOfClass:([NSString class])]) {
NSString *currentValue = [currentObject valueForKey:aTableColumn.identifier];
if ([currentValue isEqualToString:@"resolved"]) {
[attributes setObject:[NSColor colorWithCalibratedRed:0.344 green:0.619 blue:0.000 alpha:1.000] forKey:NSForegroundColorAttributeName];
}
if ([previousValue isEqualToString:@"resolved"]) {
[attributes setObject:[NSNumber numberWithInteger:NSUnderlinePatternSolid | NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
}
theValue = [[NSAttributedString alloc] initWithString:currentValue attributes:attributes];
previousValue = currentValue;
}
Как вы можете видеть, в основном, когда он пишет строку с именем "resolved", он знает, что следующий столбец, который является столбцом заголовка, получает зачеркнутый текст. Он работает просто отлично, но по какой-то причине зачеркнутый текст не рисует весь текст!
Вот изображение:
![enter image description here](https://i.stack.imgur.com/IwMc5.png)
Что здесь происходит?