Cocoanetics / DTCoreText

Methods to allow using HTML code with CoreText
BSD 2-Clause "Simplified" License
6.35k stars 1.18k forks source link

DTCoreText can't draw underline in iOS18. #1280

Open ximmyxiao opened 4 months ago

ximmyxiao commented 4 months ago

I have wrote a demo like this

- (NSAttributedString*)testContent
{
    NSString* content = @"111";

    NSMutableAttributedString* attri = [[NSMutableAttributedString alloc] initWithString:content];
    [attri addAttributes:@{NSUnderlineStyleAttributeName:@(1),NSUnderlineColorAttributeName:[UIColor redColor],NSForegroundColorAttributeName:[UIColor greenColor]} range:NSMakeRange(0, [content length]) ];

    return [attri copy];
}

and set this content to DTAttributedTextContentView, the underline will not show in iOS18 beta3 and the newest beta version of Xcode , but it works well in iOS17 and before. seems the CoreText is changed something in underline drawing in iOS18.

more exactly reason can be seem: here

daiyangyang945 commented 1 month ago

Hello, I have the same issue as you, did you solve it

nicolasmuller commented 1 month ago

+1

ZHK1024 commented 1 month ago

+1

ximmyxiao commented 1 week ago

@daiyangyang945 @nicolasmuller I found this problem only exist in some beta version of iOS , you guys can check it in the public version of iOS 18.x

daiyangyang945 commented 1 week ago

@daiyangyang945 @nicolasmuller I found this problem only exist in some beta version of iOS , you guys can check it in the public version of iOS 18.x

Okay, thank you for your reply

benjaminbarbe commented 1 week ago

@ximmyxiao @daiyangyang945 @nicolasmuller It's the same issue with the public version 18.1 😔

ximmyxiao commented 1 week ago

@benjaminbarbe , in my iPhone16 pro with iOS18.1 , the underline can be drawn well , But in my iPhone15 pro max with iPhone 18.2 beta and in any simulator with iOS 18 , the underline can't be drawn