zacwest / ZSWTappableLabel

UILabel subclass for links which are tappable, long-pressable, 3D Touchable, and VoiceOverable.
MIT License
169 stars 37 forks source link

Foreground color on link #30

Closed iKisliy closed 6 years ago

iKisliy commented 6 years ago

When I set foreground color on link, it's still blue

    atrString.addAttributes(
        [
            .tappableRegion: true,
            NSAttributedStringKey.underlineStyle :NSUnderlineStyle.styleThick.rawValue,
         NSAttributedStringKey.underlineColor : UIColor.vaiUnderline,
         NSAttributedStringKey.foregroundColor : UIColor.vaiUnderline,
         .link : urlTerms],
        range: ns2)
    termsLabel.attributedText = atrString
iKisliy commented 6 years ago

It's simulator issue, on real device everything is ok

iKisliy commented 6 years ago

Found that it's not simulator issue. On iOS 10 — 10.3 it's changing foreground color, but on 11.2+ (11.0?) it's always blue. Someone notice that behavior and how to fix it?

YuryRadchenko commented 6 years ago

Did anybody decide the trouble with a blue link color?

iKisliy commented 6 years ago

@YuryRadchenko check example, SimpleSwiftViewController.swift and MultipleSwiftViewController.swift

OrWest commented 5 years ago

Label is blue when you add to attributes link key. When remove it, but leave tappableRegion, color is correct (not default blue) and text is tappable. But how remove underline and blue color from link in UILabel?

Didn't find any hints in examples.

zacwest commented 4 years ago

You don't need to use the .link attribute, but if you want to, you can specify .foregroundColor and .underlineStyle attributes which I believe override them.