Skip to content

changsanjiang/SJLabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SJLabel

Use

pod 'SJLabel'

Example

- (void)test {
    NSAttributedString *attrStr = [[NSAttributedString alloc] initWithString:@"@迷你世界联机 :@江叔 用小淘气耍赖野人#迷你世界#. #精选#看到最后!! [点赞]!![评论]!!"];
    
    // 1. set `attributedString` delegate
    attrStr.actionDelegate = self;
    
    // 2. regular matching action
    attrStr.addAction(@"([@][^\\s]+\\s)|([#][^#]+#)|([\\[][^\\]]+\\])");
    
    // 3. set str
    sjLabel.attributedText = attrStr;
}

/// Delegate Method
- (void)attributedString:(NSAttributedString *)attrStr action:(NSAttributedString *)action {
    NSLog(@"%@", action.string);
}


About

一个支持匹配点击的 label . a label, Supports attributes text matching clicks.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published