美文网首页
2019-06-30

2019-06-30

作者: 钱嘘嘘 | 来源:发表于2018-03-06 09:26 被阅读15次

    YYKit 有迹可循

    1. YYLabel -> _state == 23条(“bitfield”数据结构)

    2. YYTextMagnifier == 9条(以”类族模式”隐藏实现细节)

    3. self.titles = @[].mutableCopy; == 4条(多用字面量语法,少用与之等价的方法)

    4. iOS 保持界面流畅的技巧 == CA高级技巧中很多,CPU & GPU

    5. description + debugDescription == 17条(实现description方法)

    6. YYTextSelectionRect == 重写的属性 — 当你在子类中重写了父类中的属性,你必须使用 @synthesize 来手动合成ivar。

    7. YYTextInput — (YYTextPosition + YYTextRange) == Text Programming Guide for iOS - Lower Level Text-Handling Technologies - A Guided Tour of a UITextInput Implementation

    8. YYWeakProxy + (NSTimer+YYAdd) == 52条(NSTimer 会保留其目标对象)

    9. all about @autoreleasepool {...} == 34条(以"自动释放池块"降低内存峰值)

    10. YYThreadSafeDictionary == PSPDFThreadSafeMutableDictionary in The Foundation Collection Classes

    11. YYMemoryCache LRU linked list == switching to custom caching code based on a LRU linked list in The Foundation Collection Classes

    12. YYDispatchQueuePool(Qos) == Prioritize Work with Quality of Service Classes

    13. YYTimer == Minimize Timer Use - Get Event Notifications Without Using Timers

    YYLabel

    YYLabel
    .h - like UILabel + Async
    .m - ReleaseQueue + _innerLayout + _highlightLayout(LongPressTimer(callback))
    -YYAsyncLayer + Touches Methods(about highlight)
    -YYAsyncLayerDelegate

    YYTextLayout
    .h - container + layout + Draw
    .m - container - encap property All methods is thread-safe.
    -layout - layoutWithContainer - ((cgPath + frameAttrs)->ctFrame)->CoreText objects->YYTextLine + needTruncation(truncationToken) + textBoundingSize + iterator text for draw property
    -Draw

    YYTextLine - encap CTLine for OC property

    YYTextInput - encap model
    -YYTextPosition : UITextPosition
    -YYTextRange : UITextRange
    -YYTextSelectionRect : UITextSelectionRect

    YYTextAttribute - encap model
    -YYTextBackedString
    -YYTextBinding
    -YYTextShadow
    -YYTextDecoration
    -YYTextBorder
    -YYTextAttachment
    -YYTextHighlight

    相关文章

      网友评论

          本文标题:2019-06-30

          本文链接:https://www.haomeiwen.com/subject/rykcxftx.html