CCTagsTextView 0.2.2

CCTagsTextView 0.2.2

测试测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2016年10月

Mandea Daniel 维护。



关于

这是一个基于 UITextView 的包装器,提供了在输入文本中查找和标记标签的支持。查看示例项目以获取想法。

用法

要运行示例项目,首先克隆仓库,然后在 Example 目录中运行 pod install

  1. 在您的 storyboard 或 xib 中创建一个视图
  2. 将您的 IBOutlet 连接到 VC
@property (weak, nonatomic) IBOutlet TagsTextView *tagsInputView;
  1. 视图加载后设置标签文本视图
- (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 或更高版本

安装

CCTagsTextView 通过 CocoaPods 可用。要安装它,只需将以下行添加到您的 Podfile 中

pod "CCTagsTextView"

作者

Daniel Mandea, [email protected]

许可证

CCTagsTextView 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。