2015-10-21 1 views
1
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Old price"]; 
[str addAttribute:NSStrikethroughStyleAttributeName 
         value:@2 
         range:NSMakeRange(0, [str length])]; 

Как изменить яркий цвет?Как изменить Удар по цвету?

+0

Unique вопрос ... :) –

+2

Использование 'атрибута NSStrikethroughColorAttributeName'? – Larme

ответ

0

Попробуйте с этим

NSDictionary *attrs = @{ NSFontAttributeName:[UIFont systemFontOfSize:12.0f], 
         NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle), 
         NSStrikethroughColorAttributeName: [UIColor redColor], 
         NSBackgroundColorAttributeName: [UIColor yellowColor] 
         }; 
0
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Old price"]; 
NSRange range = NSMakeRange(0, [str length]); 
[str addAttribute:NSStrikethroughStyleAttributeName value:@2 range:range]; 
[str addAttribute:NSStrikethroughColorAttributeName value:[UIColor greenColor] range:range]; 
[str addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:range];