- Notifications
You must be signed in to change notification settings - Fork28
GIKICoder/GBigbang
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
这是一个分词组件.用与文本分词,列表展示.参考Pin的分词界面.和UC的bigbang界面.(该项目是GRichLabel 文本选择复制功能的组件之一).欢迎大家star!
- 可区分标点符号与表情.
- 可自定义分词展现列表.
- 分词列表支持滑动/点击选择.
- 提供默认分词展现Container.
-(void)bigbang:(NSString*)selection{NSArray * array = [GBigbangBoxbigBang:selection]; __blockNSMutableArray *flows = [NSMutableArrayarray]; [arrayenumerateObjectsUsingBlock:^(GBigbangItem * obj,NSUInteger idx,BOOL * _Nonnull stop) { GTagFlowItem *layout = [GTagFlowItemtagFlowItemWithText:obj.text]; [flowsaddObject:layout];if (obj.isSymbolOrEmoji) { layout.appearance.backgroundColor = [UIColorgrayColor]; layout.appearance.textColor = [UIColorblackColor]; } }]; [self.containerconfigDatas:flows.copy]; [self.containershow];}
self.appearance = [GTagFlowAppearancenew]; self.appearance.borderColor = [UIColorblackColor]; self.appearance.textColor = [UIColorblackColor]; self.appearance.borderWidth =1; self.appearance.backgroundColor = [UIColorwhiteColor]; self.appearance.selectTextColor = [UIColorredColor]; self.appearance.selectBorderColor = [UIColorredColor]; self.appearance.selectBackgroundColor = [UIColorwhiteColor];NSArray *items = [GBigbangBoxbigBang:self.string];NSArray * layouts = [GTagFlowItemfactoryFolwLayoutWithItems:itemswithAppearance:self.appearance]; self.flowView.flowDatas = layouts; [self.flowViewreloadDatas];
GTagFlowContainer *container = [GTagFlowContainernew]; self.container = container;/// 使用自定义流水布局 [self.container.flowViewconfigTagCollectionViewLayout]; self.container.actionBtnItems = @[@"复制",@"举报",@"错别字"]; self.container.actionBlock = ^(NSString *actionTitle,NSString *newText) {NSLog(@"点击了 --%@, 选择的文字 --%@",actionTitle,newText); };NSArray * layouts = [GTagFlowItemfactoryFolwLayoutWithItems:itemswithAppearance:nil]; self.flowView.flowDatas = layouts; [self.flowViewreloadDatas];
- Add
pod 'GBigbang'
to your Podfile. - Run
pod install
orpod update
. - Import "GBigbang.h"
git clone https://github.com/GIKICoder/GBigbang.git
- 选择
GBigbang
文件夹.拖入项目中即可.
- 2017/11/24 : 增加自定义布局Layout. bigbang列表可使用自定义布局. 实现固定间距列表.