Skip to content

The tag is generated by the attributedText πŸ“Œ

License

Notifications You must be signed in to change notification settings

Lcrnice/CRTagsLabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CRTagsLabel

πŸ“ŒCRTagsLabel generated tag by the attributedText.

Preview

You're probably curious how it looks. Here you are:

CRTagsLabel_Gif

Usage

Create a subclass of CRTagsView to dispay tag , override -setupTagsViewWithModel: to set model.

- (void)setupTagsViewWithModel:(id)model {
    CRModel *tag = (CRModel *)model;
    NSString *title = tag.title;
    
    self.label.attributedText = [self cr_attributedString:title];
}

Create CRTagsLabel in UIViewController, config block and tags.

NSAttributedString *(^block)() = ^NSAttributedString *() {
    CRCustomTagsView *customTagView = [CRCustomTagsView new];

    return [customTagView attributedStringWithTags:tags];
};
    
CRTagsLabel *tagsLabel = [[CRTagsLabel alloc] initWithBlock:block];
tagsLabel.tags = tags;
[self.view addSubview:tagsLabel];
[tagsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(@100);
    make.left.equalTo(@10);
    make.right.equalTo(@-10);
}];

Requirements

  • iOS 8.0+
  • ARC

TODO

  • add to CocoaPods

Contributing

Issues and pull requests are welcome!

Author

Lcrnice @Lcrnice

License

CRTagsLabel is released under an MIT license. See LICENSE for more information.

About

The tag is generated by the attributedText πŸ“Œ

Resources

License

Stars

Watchers

Forks

Packages

No packages published