#Introduction
JDHashTagModule let u can simply make your UITextView and UITableView become "HashTag Detector" & "HashTag Picker"
Thanks for using.
#Usage
@implementation ViewController
{
JDHashTagModule *hashtagmodel;
}
-(void)viewDidLoad {
hashtagmodel = [[JDHashTagModule alloc] initWithTable_Text:__tableview txt:__textview];
}
##Notice
To trigger HashTag highlight, you need to add A space at the start of tag(#) and the end of tag
_#tag_
To trigger NameTag highlight, you need to add A space at the start of tag(@) and the end of tag
_@name_
and '@' will remove automatically. -> _name_
###Method: -For Color
Change HashTagColor, it will change the color of hashtag which is displaying.
-(void)setHashTagColor:(UIColor *)color;
Change NameTagBackgroundColor, it will change the color of hashtag which is displaying.
-(void)setNameTagColor:(UIColor *)color;
-For Dictionary If you think the HashTagPicker's tag doesn't show the tag you want, you can add your own Tag into Dictionary.
-(void)addToDictionary:(NSString*)input;
-(void)addArrayToDictionary:(NSArray *)inputs;
Example:
[hashtagmodel addToDictionary:@"JamesDouble"];
[hashtagmodel addArrayToDictionary:@[@"HashTag",@"GitHub"]];
###Delegate(Optional): Also, you could Implements the delegate, then you will receive notify when User "Click" On HashTag.
hashtagmodel.delegate = self;
-(void)hastapHashTag:(NSString*)tag
{
UIAlertController *_alert = [[UIAlertController alertControllerWithTitle:tag message:@"" preferredStyle:UIAlertControllerStyleAlert] init];
UIAlertAction* ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[_alert dismissViewControllerAnimated:YES completion:nil];
}];
[_alert addAction:ok];
[self presentViewController:_alert animated:YES completion:nil];
}