cruisediary / Pastel

🎨 Gradient animation effect like Instagram
MIT License
3.5k stars 185 forks source link

Add PastelLabel #11

Open cruisediary opened 7 years ago

cruisediary commented 7 years ago

PastelLabel

desc

kgellci commented 7 years ago

I was going to tackle this issue but I ended up rewriting much of the framework to add some extra abilities I was looking for, (motion color shifting). Feel free to take a look at my implementation, specifically in the ShiftUI file. When I have more time, I will explore a solution which does not wrap a UIlabel in a UIView, as show in the ShiftImageView class implementation vs ShiftMaskableLabel implementation:

https://github.com/kgellci/Shift/blob/master/Shift/Classes/ShiftUI.swift

cruisediary commented 7 years ago

@kgellci nice job. looks good to me i give star too :) I don't want to use wrapping methods but In the case of UIButton, it is itself wrapping label and imageView too

    // UIButton
    @available(iOS 3.0, *)
    open var titleLabel: UILabel? { get }

    @available(iOS 3.0, *)
    open var imageView: UIImageView? { get }

so I wrapped the UILabel once and tried to use the functionality of the UILabel like an adapter in #16

public protocol PastelLabelable {
    var text: String? { get set }
    var font: UIFont? { get set }
    var textAlignment: NSTextAlignment { get set }
    var attributedText: NSAttributedString? { get set }
}

If you find how to mask a UILabel without wrapping it, I would appreciate it if you would share it I'm considering to solve this use CATextLayer or override drawTextInRect of UILabel too :)

I reopen Issue Masking PastelLabel without wrapping to solve it

Shift nice job :D thank you

kgellci commented 7 years ago

I will try and take a look this weekend. There is a way to do it w/o wrapping but need to take care of different cases like updating text, font, etc.