下拉刷新
项目详情
navbar_avatar分享
repo_avatar
HelloGitHub 评分
0 人评分
基于 UITextView 书写风格类似于 masonry 的 iOS 端富文本控件
开源MIT
认领
收藏
分享
459
星数
中文
Objective-C
主语言
活跃
1
贡献者
12
Issues
组织
最新版本
74
Forks
MIT
协议
更多
基于 UITextView 书写风格类似于 masonry 的 iOS 端富文本控件。它采用声明式(链式)方法定义富文本控件,与编程式的相比它所需的代码量更短、更直观和易用。示例代码: ``` #import "NudeIn.h" /// 声明控件为你的成员变量 @property (nonatomic,strong) NudeIn *attrLabel; /// Do it yourself _attrLabel = [NudeIn make:^(NUDTextMaker *make) { make.text(@"this is a ").font(14).color([UIColor blackColor]).attach(); make.text(@"BlueLink").font(17).color([UIColor blueColor]).link(self,@selector(linkHandler:)).attach(); make.text(@", and this is a ").font(14).color([UIColor blackColor]).attach(); make.text(@"RedLink").font(17).color([UIColor redColor]).link(self,@selector(linkHandler:)).attach(); }]; /// 对声明了 link 属性的部分定义回调 (void)linkHandler:(NUDAction *)action { if ([action isKindOfClass:[NUDLinkAction class]]) { NUDLinkAction *linkAction = (NUDLinkAction *)action; UIAlertController *alertController = [UIAlertController alertControllerWithTitle:linkAction.string message:nil preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { }]]; [self presentViewController:alertController animated:YES completion:nil]; } } ```
收录于:
第 33 期

评论

评分:
暂无精选评论