NSAttributedString Strikethrough не рисует по всей длине текста - PullRequest
4 голосов
/ 17 февраля 2011

Я вставляю 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

Что здесь происходит?

1 Ответ

2 голосов
/ 21 февраля 2011

Еще одна странность с поддержкой слоев.Вот я и выключил: (

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...