功能强大的 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

Watch4750Fork752

项目描述: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

posted on 2016-05-09 08:02  奔跑的蜗牛ing  阅读(10546)  评论(0编辑  收藏  举报

导航