介绍
本仓库是iOS端的weex富文本组件。本质上是一个UITextView,用于将HTML字符串解析成NSAttributedString。
但是,并不是所有HTML样式都能被解析出来,比如圆角、渐变、边框等。
本组件对这些特殊样式也一样做了支持,并且支持自定义超链接颜色、文字行数获取等扩展功能。
Cocoapods
pod 'KSWXRichTextComponent'
效果演示
如何使用
1.原生中注册组件
[WXSDKEngine registerComponent:@"rich-text" withClass:[KSWXRichTextComponent class]];
2.前端中使用组件
.rich {
color: red;
}
外部样式(class)
color: ;
fontFamily: ;
fontSize: ;
textAlign: ;
lineHeight: ;
paddingLeft: ;
paddingRight: ;
paddingTop: ;
paddingBottom: ;
letterSpacing: ;
textOverflow: ; // only ellipsis
lines: ;