简体   繁体   English

如何在带有标签的textview中显示数组数据,以及如何在iOS用户列表中通过搜索功能添加更多标签

[英]How to show the array data in textview with Tag and how to add more tag with search Functionality in user list in ios

I'm stuck when View Load first time i want to show some array data with tag.And after this i want to add another tag like more than one. 第一次加载View时我被卡住了,我想显示一些带有tag的数组数据。此后,我想添加另一个标签,比如多个。

I'm using Third party: TITokenField 我正在使用第三方:TITokenField

  NSArray * names=ary_ContactDetail;
    TIToken * token=[_tokenFieldView.tokenField addTokenWithTitle:[names objectAtIndex:(arc4random() % names.count)]];
    [token setAccessoryType:TITokenAccessoryTypeDisclosureIndicator];
    // If the size of the token might change, it's a good idea to layout again.
    [_tokenFieldView.tokenField layoutTokensAnimated:YES];
    NSUInteger tokenCount=_tokenFieldView.tokenField.tokens.count;
    [token setTintColor:((tokenCount % 3) == 0 ? [TIToken redTintColor] : ((tokenCount % 2) == 0 ? [TIToken greenTintColor] : [TIToken blueTintColor]))];

Please help me 请帮我

TIToken * token = [[TIToken alloc] initWithTitle:[self displayStringForRepresentedObject:representedObject] representedObject:representedObject];
[_tokenField addToken:token];

of use this method .. - (TIToken *)addTokenWithTitle:(NSString *)title 使用此方法- (TIToken *)addTokenWithTitle:(NSString *)title

As I referred the library, this is the code for adding new token. 正如我提到的库一样,这是添加新令牌的代码。 I don't have working experience in this. 我没有工作经验。 And you have to manage the tag array also. 而且,您还必须管理标签数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM