Repository Details
Shared by


HelloGitHub Rating
0 ratings
Free•MIT
Claim
Discuss
Collect
Share
459
Stars
Yes
Chinese
Objective-C
Language
No
Active
1
Contributors
12
Issues
No
Organization
None
Latest
74
Forks
MIT
License
More
基于 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];
}
}
```
Included in:
Vol.33
Comments
Rating:
No comments yet