iOS 10.3删除线无法渲染的bug

技术渣苹果又搞事情,具体传送门见:http://stackoverflow.com/questions/43074652/ios-10-3-nsstrikethroughstyleattributename-is-not-rendered-if-applied-to-a-sub

解决方案,增加如下代码:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[[NSAttributedString alloc] initWithString:text attributes:@{NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle),
NSFontAttributeName: [UIFont systemFontOfSize:fontSize],
NSForegroundColorAttributeName: UIColorFromRGB(0xbcbcbc),
NSBaselineOffsetAttributeName: @(0)}];
[[NSAttributedString alloc] initWithString:text attributes:@{NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle), NSFontAttributeName: [UIFont systemFontOfSize:fontSize], NSForegroundColorAttributeName: UIColorFromRGB(0xbcbcbc), NSBaselineOffsetAttributeName: @(0)}];
 [[NSAttributedString alloc] initWithString:text attributes:@{NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle),
                                                                        NSFontAttributeName: [UIFont systemFontOfSize:fontSize],
                                                                        NSForegroundColorAttributeName: UIColorFromRGB(0xbcbcbc),
                                                                        NSBaselineOffsetAttributeName: @(0)}];

最底下那行是关键

Leave a Reply

Your email address will not be published. Required fields are marked *