功能強大的 iOS 富文本編輯與顯示框架:YYText


功能強大的 iOS 富文本編輯與顯示框架。
(該項目是 YYKit 組件之一) 

特性 

  • API 兼容 UILabel 和 UITextView 
  • 支持高性能的異步排版和渲染 
  • 擴展了 CoreText 的屬性以支持更多文字效果 
  • 支持 UIImage、UIView、CALayer 作為圖文混排元素 
  • 支持添加自定義樣式的、可點擊的文本高亮范圍 
  • 支持自定義文本解析 (內置簡單的 Markdown/表情解析) 
  • 支持文本容器路徑、內部留空路徑的控制 
  • 支持文字豎排版,可用於編輯和顯示中日韓文本 
  • 支持圖片和富文本的復制粘貼 
  • 文本編輯時,支持富文本占位符 
  • 支持自定義鍵盤視圖 
  • 撤銷和重做次數的控制 
  • 富文本的序列化與反序列化支持 
  • 支持多語言,支持 VoiceOver 
  • 全部代碼都有文檔注釋 

架構 

YYText 和 TextKit 架構對比 

文本屬性 

YYText 原生支持的屬性 

Demo  Attribute Name  Class 
TextBackedString  YYTextBackedString 
TextBinding  YYTextBinding 
TextShadow  YYTextShadow 
TextInnerShadow  YYTextShadow 
TextUnderline  YYTextDecoration 
TextStrickthrough  YYTextDecoration 
TextBorder  YYTextBorder 
TextBackgroundBorder  YYTextBorder 
TextBlockBorder  YYTextBorder 
TextAttachment  YYTextAttachment 
TextHighlight  YYTextHighlight 
TextGlyphTransform  NSValue(CGAffineTransform) 

YYText 支持的 CoreText 屬性 

Demo  Attribute Name  Class 
Font  UIFont(CTFontRef) 
Kern  NSNumber 
StrokeWidth  NSNumber 
StrokeColor  CGColorRef 
Shadow  NSShadow 
Ligature  NSNumber 
VerticalGlyphForm  NSNumber(BOOL) 
WritingDirection  NSArray(NSNumber) 
RunDelegate  CTRunDelegateRef 
TextAlignment  NSParagraphStyle 
(NSTextAlignment) 
LineBreakMode  NSParagraphStyle 
(NSLineBreakMode) 
LineSpacing  NSParagraphStyle 
(CGFloat) 
ParagraphSpacing 
ParagraphSpacingBefore 
NSParagraphStyle 
(CGFloat) 
FirstLineHeadIndent  NSParagraphStyle 
(CGFloat) 
HeadIndent  NSParagraphStyle 
(CGFloat) 
TailIndent  NSParagraphStyle 
(CGFloat) 
MinimumLineHeight  NSParagraphStyle 
(CGFloat) 
MaximumLineHeight  NSParagraphStyle 
(CGFloat) 
LineHeightMultiple  NSParagraphStyle 
(CGFloat) 
BaseWritingDirection  NSParagraphStyle 
(NSWritingDirection) 
DefaultTabInterval 
TabStops 
NSParagraphStyle 
CGFloat/NSArray(NSTextTab) 

用法 

基本用法 

// YYLabel (和 UILabel 用法一致)
YYLabel *label = [YYLabel new];
label.frame = ...
label.font = ...
label.textColor = ...
label.textAlignment = ...
label.lineBreakMode = ...
label.numberOfLines = ...
label.text = ...

// YYTextView (和 UITextView 用法一致)
YYTextView *textView = [YYTextView new];
textView.frame = ...
textView.font = ...
textView.textColor = ...
textView.dataDetectorTypes = ...
textView.placeHolderText = ...
textView.placeHolderTextColor = ...
textView.delegate = ...

 

項目主頁:http://www.open-open.com/lib/view/home/1447216582147

ibireme /  YYText

Watch 4750Fork 752

項目描述:Powerful text framework for iOS to display and edit rich text. — 查看更多內容...


問題列表:
#309 yylabel中全部是emoji表情時,設置行間距無效 由 wusw  2016-05-06
#308 YYTextBorder顯示不完整 由 BaeCheung  2016-05-06
#307 can not find the YYTextView on [UIResponder currentFirstResponder]? 由 pamredrum  2016-05-07
#306 No highlight status 由 medisean  2016-05-06
#305 YYLabel attributed text default linespacing is not Zero 由 tobatha  2016-05-05
 

分支代碼更新時間:2016-04-21

開發語言:Objective-C

下載ZIP


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM