[![CI Status](http://img.shields.io/travis/Daniel Mandea/CCTagsTextView.svg?style=flat)](https://travis-ci.org/Daniel Mandea/CCTagsTextView)
This is a wrapper over UITextView that offers support for finding and marking tags in the text entered. Take a look over example project in order to get the ideea.
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Create a view in your storyboard or xib
- Connect your IBOutlet with the VC
@property (weak, nonatomic) IBOutlet TagsTextView *tagsInputView;
- After the view was loaded setup tags text view
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// setup tags text view
// Setup Tags Text View
self.tagsInputView.tagsMarker = kTagsMarker;
self.tagsInputView.placeholderText = DESCRIPTION_TEXT_VIEW_PLACEHOLDER;
self.tagsInputView.textDefaultAttributes = @{
NSFontAttributeName:[UIFont systemFontOfSize:15],
NSForegroundColorAttributeName:[UIColor blackColor],
NSBackgroundColorAttributeName: [UIColor whiteColor]};
self.tagsInputView.placeholderDefaultAttributes = @{
NSFontAttributeName:[UIFont systemFontOfSize:15],
NSForegroundColorAttributeName:[UIColor lightGrayColor]};
self.tagsInputView.delegate = self;
}
#pragma mark - TagsTextViewDelegate
- (void)tagsTextViewUpdatedText:(NSString * __nullable)text {
// Here is all the string
}
- (void)tagsTextViewUpdatedTags:(NSArray * __nullable)tags {
NSMutableString *tagsString = [[NSMutableString alloc] init];
for (NSString *tag in tags) {
[tagsString appendString:[NSString stringWithFormat:@"%@ ", tag]];
}
self.relatedTagsLabel.text = tagsString;
}
iOS 8 or later
CCTagsTextView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "CCTagsTextView"
Daniel Mandea, daniel.mandea@mindmagnetsoftware.com
CCTagsTextView is available under the MIT license. See the LICENSE file for more info.