├── .gitignore ├── EYTagView ├── EYTagView.h ├── EYTagView.m ├── EYTextField.h └── EYTextField.m ├── EYTagView_Example ├── EYTagView_Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── EYTagView_Example │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── TableViewController.h │ ├── TableViewController.m │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ └── Localizable.strings │ ├── main.m │ └── zh-Hans.lproj │ │ ├── LaunchScreen.strings │ │ ├── Localizable.strings │ │ └── Main.strings └── EYTagView_ExampleTests │ ├── EYTagView_ExampleTests.m │ └── Info.plist ├── LICENSE ├── README.MD └── screenshots ├── 1editable.gif └── 1scrollable.gif /.gitignore: -------------------------------------------------------------------------------- 1 | tuangou.xcworkspace/xcuserdata/* 2 | *Breakpoints* 3 | ompiled source # 4 | ################### 5 | *.com 6 | *.class 7 | *.dll 8 | *.exe 9 | *.o 10 | *.so 11 | 12 | # Packages # 13 | ############ 14 | # it's better to unpack these files and commit the raw source 15 | # git has its own built in compression methods 16 | *.7z 17 | *.dmg 18 | *.gz 19 | *.iso 20 | *.jar 21 | *.rar 22 | *.tar 23 | *.zip 24 | 25 | # Logs and databases # 26 | ###################### 27 | *.log 28 | *.sql 29 | *.sqlite 30 | 31 | # OS generated files # 32 | ###################### 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | Icon? 39 | ehthumbs.db 40 | Thumbs.db 41 | 42 | /build/ 43 | *.dat 44 | UserInterfaceState.xcuserstate 45 | xcuserdata/ 46 | Pods/Pods.xcodeproj/xcuserdata/ 47 | EYTagView_Example/EYTagView_Example.xcodeproj/project.xcworkspace/xcshareddata/ 48 | -------------------------------------------------------------------------------- /EYTagView/EYTagView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagView.h 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | // 9 | // Current Version Time: 2015-08-27 10 | // 11 | 12 | #import 13 | 14 | 15 | 16 | #define COLORRGBA(c,a) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 \ 17 | green:((c>>8)&0xFF)/255.0 \ 18 | blue:(c&0xFF)/255.0 \ 19 | alpha:a] 20 | #define COLORRGB(c) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 \ 21 | green:((c>>8)&0xFF)/255.0 \ 22 | blue:(c&0xFF)/255.0 \ 23 | alpha:1.0] 24 | 25 | 26 | 27 | #define _K_SCREEN_WIDTH ([[UIScreen mainScreen ] bounds ].size.width) 28 | 29 | #ifndef DEBUG_LOG 30 | #define DEBUG_LOG 31 | #define LOGERROR NSLog(@"error !!!!!!!!! %s,%d",__FUNCTION__,__LINE__); 32 | #define LOGWARNING NSLog(@"warning %s,%d",__FUNCTION__,__LINE__); 33 | #define LOGERRORMSG(msg) NSLog(@"error:%@ %s,%d",msg,__FUNCTION__,__LINE__); 34 | #define LOGLINE NSLog(@"info %s,%d",__FUNCTION__,__LINE__); 35 | #define LOGINFO(format,value) NSLog([NSString stringWithFormat:@"%@ ; info %%s,%%d",format],value,__FUNCTION__,__LINE__); 36 | #define LOGTEXT(value) NSLog(@"%@ ; info %s,%d",value,__FUNCTION__,__LINE__); 37 | #define LOGTODO NSLog(@"TODO !!!!! ; info %s,%d",__FUNCTION__,__LINE__); 38 | #define LOGTIME NSLog(@"%f %s,%d",[[NSDate date]timeIntervalSince1970],__FUNCTION__,__LINE__); 39 | 40 | #define LOGNOTHING(format,value) 41 | #endif 42 | 43 | @class EYTagView; 44 | @protocol EYTagViewDelegate 45 | 46 | @optional 47 | -(void)heightDidChangedTagView:(EYTagView*)tagView; 48 | 49 | -(void)tagDidBeginEditing:(EYTagView*)tagView; 50 | -(void)tagDidEndEditing:(EYTagView*)tagView; 51 | 52 | /** 53 | * @return whether delete 54 | */ 55 | -(BOOL)willRemoveTag:(EYTagView*)tagView index:(NSInteger)index; 56 | @end 57 | 58 | typedef enum{ 59 | EYTagView_Type_Edit, 60 | EYTagView_Type_Edit_Only_Delete, 61 | EYTagView_Type_Display, 62 | EYTagView_Type_Single_Selected, 63 | EYTagView_Type_Multi_Selected, 64 | EYTagView_Type_Multi_Selected_Edit, 65 | EYTagView_Type_Flow, 66 | }EYTagView_Type; 67 | 68 | @interface EYTagView : UIView 69 | @property (nonatomic, strong) id delegate; 70 | @property (nonatomic, strong) UITextField* tfInput; 71 | @property (nonatomic) EYTagView_Type type;//default edit 72 | 73 | 74 | 75 | /** 76 | * numberOfLines & preferredMaxLayoutWidth just like UILabel 77 | */ 78 | @property (nonatomic) NSInteger numberOfLines;//default 0 79 | 80 | @property (nonatomic) float tagHeight;//default 81 | 82 | @property (nonatomic) float viewMaxHeight; 83 | 84 | @property (nonatomic) CGSize tagPaddingSize;//top & left 85 | @property (nonatomic) CGSize textPaddingSize; 86 | 87 | 88 | @property (nonatomic, strong) UIFont* fontTag; 89 | @property (nonatomic, strong) UIFont* fontInput; 90 | 91 | 92 | @property (nonatomic, strong) UIColor* colorTag; 93 | @property (nonatomic, strong) UIColor* colorTagUnselected; 94 | @property (nonatomic, strong) UIColor* colorTagBoard; 95 | @property (nonatomic, strong) UIColor* colorInput; 96 | @property (nonatomic, strong) UIColor* colorInputPlaceholder; 97 | 98 | @property (nonatomic, strong) UIColor* colorTagBg; 99 | @property (nonatomic, strong) UIColor* colorInputBg; 100 | @property (nonatomic, strong) UIColor* colorInputBoard; 101 | 102 | @property (assign) NSInteger maxSelected; 103 | @property (nonatomic, strong) NSMutableArray *tagArrows;//array of alll arrow 104 | 105 | 106 | - (void)addTags:(NSArray *)tags; 107 | - (void)addTags:(NSArray *)tags selectedTags:(NSArray*)selectedTags; 108 | - (NSArray *)getTagTexts; 109 | - (void)removeAllTags; 110 | - (void)removeTag:(NSString *)tag; 111 | - (void)removeTagWithIndex:(NSInteger)index; 112 | -(void)layoutTagviews; 113 | -(void)setTagStringsSelected:(NSMutableArray *)tagStringsSelected; 114 | -(NSMutableArray *)tagStrings; 115 | -(void)finishEditing; 116 | @end 117 | -------------------------------------------------------------------------------- /EYTagView/EYTagView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagView.m 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | 10 | 11 | 12 | 13 | #import "EYTagView.h" 14 | #import "EYTextField.h" 15 | 16 | #ifndef EYLOCALSTRING 17 | #define EYLOCALSTRING(STR) NSLocalizedString(STR, STR) 18 | #endif 19 | 20 | @interface EYCheckBoxButton :UIButton 21 | @property (nonatomic, strong) UIColor* colorBg; 22 | @property (nonatomic, strong) UIColor* colorText; 23 | @property (nonatomic, strong) UIColor* colorTagUnSelected; 24 | @property (nonatomic, strong) UIColor* colorTagBorder; 25 | 26 | @end 27 | 28 | @implementation EYCheckBoxButton 29 | -(void)setSelected:(BOOL)selected{ 30 | [super setSelected:selected]; 31 | if (selected) { 32 | [self setBackgroundColor:_colorBg]; 33 | self.layer.borderColor=_colorBg.CGColor; 34 | [self setTitleColor:_colorText forState:UIControlStateSelected]; 35 | } else { 36 | [self setBackgroundColor:COLORRGB(0xffffff)]; 37 | self.layer.borderColor=_colorTagBorder.CGColor; 38 | self.layer.borderWidth=1; 39 | [self setTitleColor:_colorTagUnSelected forState:UIControlStateNormal]; 40 | } 41 | [self setNeedsDisplay]; 42 | } 43 | @end 44 | 45 | 46 | @interface EYTagView() 47 | @property (nonatomic) CGFloat newHeight; 48 | @property (nonatomic, strong) UIScrollView* svContainer; 49 | @property (nonatomic, strong) NSMutableArray *tagStrings;//check whether tag is duplicated 50 | @property (nonatomic, strong) NSMutableArray *tagButtons;//array of alll tag button 51 | @property (nonatomic, strong) NSMutableArray *tagStringsSelected; 52 | @property (assign) NSInteger tagButtonSelecteds; 53 | 54 | @end 55 | 56 | @implementation EYTagView 57 | { 58 | NSInteger _editingTagIndex; 59 | BOOL _isInit; 60 | } 61 | 62 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 63 | { 64 | self = [super initWithCoder:aDecoder]; 65 | if (self) { 66 | [self commonInit]; 67 | } 68 | return self; 69 | } 70 | 71 | - (instancetype)initWithFrame:(CGRect)frame 72 | { 73 | self = [super initWithFrame:frame]; 74 | if (self) { 75 | [self commonInit]; 76 | } 77 | return self; 78 | } 79 | 80 | 81 | - (void)commonInit 82 | { 83 | _newHeight=self.frame.size.height; 84 | _type=EYTagView_Type_Edit; 85 | _tagHeight=18; 86 | _tagPaddingSize=CGSizeMake(6, 6); 87 | _textPaddingSize=CGSizeMake(0, 3); 88 | _fontTag=[UIFont systemFontOfSize:14]; 89 | self.fontInput=[UIFont systemFontOfSize:14]; 90 | _colorTag=COLORRGB(0xffffff); 91 | _colorTagUnselected=COLORRGB(0xa1a2a2); 92 | _colorInput=COLORRGB(0x2ab44e); 93 | _colorInputPlaceholder=COLORRGB(0x2ab44e); 94 | _colorTagBg=COLORRGB(0x2ab44e); 95 | _colorTagBoard=COLORRGB(0xdddddd); 96 | _colorInputBg=COLORRGB(0xbbbbbb); 97 | _colorInputBoard=COLORRGB(0x2ab44e); 98 | _viewMaxHeight=130; 99 | self.clipsToBounds=YES; 100 | self.backgroundColor=COLORRGB(0xffffff); 101 | _maxSelected = 0; 102 | _tagButtonSelecteds = 0; 103 | 104 | _tagButtons=[NSMutableArray new]; 105 | _tagArrows=[NSMutableArray new]; 106 | _tagStrings=[NSMutableArray new]; 107 | _tagStringsSelected=[NSMutableArray new]; 108 | 109 | { 110 | UIScrollView* sv = [[UIScrollView alloc] initWithFrame:self.bounds]; 111 | sv.autoresizingMask=UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 112 | sv.contentSize=sv.frame.size; 113 | sv.contentSize=CGSizeMake(sv.frame.size.width, 600); 114 | sv.indicatorStyle=UIScrollViewIndicatorStyleDefault; 115 | sv.backgroundColor = self.backgroundColor; 116 | sv.showsVerticalScrollIndicator = YES; 117 | sv.showsHorizontalScrollIndicator = NO; 118 | [self addSubview:sv]; 119 | _svContainer=sv; 120 | } 121 | { 122 | UITextField* tf = [[EYTextField alloc] initWithFrame:CGRectMake(0, 0, 0, _tagHeight)]; 123 | tf.autocorrectionType = UITextAutocorrectionTypeNo; 124 | [tf addTarget:self action:@selector(textFieldDidChange:)forControlEvents:UIControlEventEditingChanged]; 125 | tf.delegate = self; 126 | tf.placeholder=EYLOCALSTRING(@"Add Tag"); 127 | tf.returnKeyType = UIReturnKeyDone; 128 | [_svContainer addSubview:tf]; 129 | _tfInput=tf; 130 | } 131 | { 132 | UITapGestureRecognizer* panGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector 133 | (handlerTapGesture:)]; 134 | panGestureRecognizer.numberOfTapsRequired=1; 135 | [self addGestureRecognizer:panGestureRecognizer]; 136 | } 137 | } 138 | #pragma mark - 139 | -(NSMutableArray *)tagStrings{ 140 | switch (_type) { 141 | case EYTagView_Type_Edit: 142 | case EYTagView_Type_Edit_Only_Delete: 143 | { 144 | return _tagStrings; 145 | } 146 | break; 147 | case EYTagView_Type_Display: 148 | { 149 | return nil; 150 | } 151 | break; 152 | case EYTagView_Type_Single_Selected: 153 | { 154 | [_tagStringsSelected removeAllObjects]; 155 | for (EYCheckBoxButton* button in _tagButtons) { 156 | if (button.selected) { 157 | [_tagStringsSelected addObject:button.titleLabel.text]; 158 | break; 159 | } 160 | } 161 | return _tagStringsSelected; 162 | } 163 | break; 164 | case EYTagView_Type_Multi_Selected: 165 | { 166 | [_tagStringsSelected removeAllObjects]; 167 | for (EYCheckBoxButton* button in _tagButtons) { 168 | if (button.selected) { 169 | [_tagStringsSelected addObject:button.titleLabel.text]; 170 | } 171 | } 172 | return _tagStringsSelected; 173 | } 174 | break; 175 | case EYTagView_Type_Multi_Selected_Edit: 176 | { 177 | [_tagStringsSelected removeAllObjects]; 178 | for (EYCheckBoxButton* button in _tagButtons) { 179 | if (button.selected) { 180 | [_tagStringsSelected addObject:button.titleLabel.text]; 181 | } 182 | } 183 | return _tagStringsSelected; 184 | } 185 | default: 186 | { 187 | 188 | } 189 | break; 190 | } 191 | return nil; 192 | } 193 | -(UIView*)newArrowView{ 194 | UIView* vArrow=[[UIView alloc]initWithFrame:CGRectMake(0, 0, _tagHeight*1.5f, _tagHeight)]; 195 | vArrow.backgroundColor=[UIColor clearColor]; 196 | { 197 | UILabel* lb=[[UILabel alloc]initWithFrame:vArrow.frame]; 198 | lb.textAlignment=NSTextAlignmentCenter; 199 | lb.text=@"···>"; 200 | lb.font=[UIFont systemFontOfSize:13]; 201 | lb.textColor=_colorTagBg; 202 | lb.backgroundColor=[UIColor clearColor]; 203 | [vArrow addSubview:lb]; 204 | } 205 | 206 | 207 | return vArrow; 208 | } 209 | 210 | -(void)layoutTagviews{ 211 | float oldContentHeight=_svContainer.contentSize.height; 212 | float offsetX=_tagPaddingSize.width,offsetY=_tagPaddingSize.height; 213 | 214 | if (_type==EYTagView_Type_Flow){ 215 | for (UIView* v in _tagArrows) { 216 | [v removeFromSuperview]; 217 | } 218 | [_tagArrows removeAllObjects]; 219 | 220 | } 221 | 222 | BOOL needLayoutAgain=NO;// just for too large text 223 | BOOL shouldFinishLayout=NO;//just for break line 224 | int currentLine=0; 225 | for (int i=0; i<_tagButtons.count; i++) { 226 | EYCheckBoxButton* tagButton=_tagButtons[i]; 227 | tagButton.hidden=NO; 228 | if (shouldFinishLayout) { 229 | tagButton.hidden=YES; 230 | continue; 231 | } 232 | CGRect frame=tagButton.frame; 233 | 234 | if (tagButton.frame.size.width+_tagPaddingSize.width*2>_svContainer.contentSize.width) { 235 | NSLog(@"!!! tagButton width tooooooooo large"); 236 | [tagButton removeFromSuperview]; 237 | [_tagButtons removeObjectAtIndex:i]; 238 | [_tagStrings removeObjectAtIndex:i]; 239 | needLayoutAgain=YES; 240 | break; 241 | }else{ 242 | //button 243 | if ((offsetX+tagButton.frame.size.width+_tagPaddingSize.width) 244 | <=_svContainer.contentSize.width) { 245 | frame.origin.x=offsetX; 246 | frame.origin.y=offsetY; 247 | offsetX+=tagButton.frame.size.width+_tagPaddingSize.width; 248 | }else{//break line 249 | currentLine++; 250 | if (_numberOfLines!=0 251 | && _numberOfLines<=currentLine) { 252 | shouldFinishLayout=YES; 253 | if (_type==EYTagView_Type_Flow 254 | && i!=0) {//not first one 255 | [_tagArrows.lastObject removeFromSuperview]; 256 | [_tagArrows removeLastObject]; 257 | } 258 | tagButton.hidden=YES; 259 | continue; 260 | } 261 | 262 | offsetX=_tagPaddingSize.width; 263 | offsetY+=_tagHeight+_tagPaddingSize.height; 264 | 265 | frame.origin.x=offsetX; 266 | frame.origin.y=offsetY; 267 | offsetX+=tagButton.frame.size.width+_tagPaddingSize.width; 268 | } 269 | tagButton.frame=frame; 270 | //arrow 271 | if (_type==EYTagView_Type_Flow 272 | && i!=_tagButtons.count-1) { 273 | UIView* vArrow=[self newArrowView]; 274 | 275 | frame=vArrow.frame; 276 | if ((offsetX+vArrow.frame.size.width+_tagPaddingSize.width) 277 | <=_svContainer.contentSize.width) { 278 | frame.origin.x=offsetX; 279 | frame.origin.y=offsetY; 280 | offsetX+=vArrow.frame.size.width+_tagPaddingSize.width; 281 | }else{//break line 282 | currentLine++; 283 | if (_numberOfLines!=0 284 | && _numberOfLines<=currentLine) { 285 | shouldFinishLayout=YES; 286 | continue; 287 | } 288 | 289 | offsetX=_tagPaddingSize.width; 290 | offsetY+=_tagHeight+_tagPaddingSize.height; 291 | 292 | frame.origin.x=offsetX; 293 | frame.origin.y=offsetY; 294 | offsetX+=vArrow.frame.size.width+_tagPaddingSize.width; 295 | } 296 | vArrow.frame=frame; 297 | [_tagArrows addObject:vArrow]; 298 | [_svContainer addSubview:vArrow]; 299 | } 300 | } 301 | } 302 | if (needLayoutAgain) { 303 | [self layoutTagviews]; 304 | return; 305 | } 306 | //input view 307 | _tfInput.hidden=(_type!=EYTagView_Type_Edit && 308 | _type!=EYTagView_Type_Multi_Selected_Edit); 309 | if (_type==EYTagView_Type_Edit || _type==EYTagView_Type_Multi_Selected_Edit) { 310 | _tfInput.backgroundColor=_colorInputBg; 311 | _tfInput.textColor=_colorInput; 312 | _tfInput.font=_fontInput; 313 | [_tfInput setValue:_colorInputPlaceholder forKeyPath:@"_placeholderLabel.textColor"]; 314 | 315 | _tfInput.layer.cornerRadius = _tfInput.frame.size.height * 0.5f; 316 | _tfInput.layer.borderColor=_colorInputBoard.CGColor; 317 | _tfInput.layer.borderWidth=1; 318 | { 319 | CGRect frame=_tfInput.frame; 320 | frame.size.width = [_tfInput.text sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2; 321 | //place holde width 322 | frame.size.width=MAX(frame.size.width, [EYLOCALSTRING(@"Add Tag") sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2); 323 | _tfInput.frame=frame; 324 | } 325 | 326 | if (_tfInput.frame.size.width+_tagPaddingSize.width*2>_svContainer.contentSize.width) { 327 | NSLog(@"!!! _tfInput width tooooooooo large"); 328 | 329 | }else{ 330 | CGRect frame=_tfInput.frame; 331 | if ((offsetX+_tfInput.frame.size.width+_tagPaddingSize.width) 332 | <=_svContainer.contentSize.width) { 333 | frame.origin.x=offsetX; 334 | frame.origin.y=offsetY; 335 | offsetX+=_tfInput.frame.size.width+_tagPaddingSize.width; 336 | }else{ 337 | offsetX=_tagPaddingSize.width; 338 | offsetY+=_tagHeight+_tagPaddingSize.height; 339 | 340 | frame.origin.x=offsetX; 341 | frame.origin.y=offsetY; 342 | offsetX+=_tfInput.frame.size.width+_tagPaddingSize.width; 343 | } 344 | _tfInput.frame=frame; 345 | 346 | } 347 | 348 | } 349 | 350 | _svContainer.contentSize=CGSizeMake(_svContainer.frame.size.width, offsetY+_tagHeight+_tagPaddingSize.height); 351 | { 352 | CGRect frame=_svContainer.frame; 353 | frame.size.height=_svContainer.contentSize.height; 354 | frame.size.height=MIN(frame.size.height, _viewMaxHeight); 355 | _svContainer.frame=frame; 356 | } 357 | 358 | float oldHeight=self.frame.size.height; 359 | float newHeight=_svContainer.frame.size.height; 360 | 361 | if (self.translatesAutoresizingMaskIntoConstraints) 362 | {//autosizing 363 | { 364 | CGRect frame=self.frame; 365 | frame.size.height=newHeight; 366 | self.frame=frame; 367 | } 368 | if (!_isInit 369 | && oldHeight!= newHeight 370 | && _delegate) { 371 | [_delegate heightDidChangedTagView:self]; 372 | 373 | }else{ 374 | 375 | } 376 | }else 377 | {//auto layout 378 | if (oldHeight!= newHeight){ 379 | _newHeight = newHeight; 380 | [self invalidateIntrinsicContentSize]; 381 | } 382 | } 383 | 384 | 385 | 386 | if (oldContentHeight != _svContainer.contentSize.height) { 387 | CGPoint bottomOffset = CGPointMake(0, _svContainer.contentSize.height - _svContainer.bounds.size.height); 388 | [_svContainer setContentOffset:bottomOffset animated:YES]; 389 | } 390 | } 391 | 392 | - (EYCheckBoxButton *)tagButtonWithTag:(NSString *)tag 393 | { 394 | EYCheckBoxButton *tagBtn = [[EYCheckBoxButton alloc] init]; 395 | tagBtn.colorBg=_colorTagBg; 396 | tagBtn.colorTagUnSelected=_colorTagUnselected; 397 | tagBtn.colorTagBorder=_colorTagBoard; 398 | 399 | tagBtn.colorText=_colorTag; 400 | tagBtn.selected=YES; 401 | [tagBtn.titleLabel setFont:_fontTag]; 402 | [tagBtn setBackgroundColor:_colorTagBg]; 403 | [tagBtn setTitleColor:_colorTag forState:UIControlStateNormal]; 404 | [tagBtn addTarget:self action:@selector(handlerTagButtonEvent:) forControlEvents:UIControlEventTouchUpInside]; 405 | [tagBtn setTitle:tag forState:UIControlStateNormal]; 406 | 407 | CGRect btnFrame; 408 | btnFrame.size.height = _tagHeight; 409 | tagBtn.layer.cornerRadius = btnFrame.size.height * 0.5f; 410 | 411 | btnFrame.size.width = [tagBtn.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:_fontTag}].width + (tagBtn.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2; 412 | 413 | tagBtn.frame=btnFrame; 414 | return tagBtn; 415 | } 416 | - (void)handlerTagButtonEvent:(EYCheckBoxButton*)sender 417 | { 418 | 419 | } 420 | #pragma mark action 421 | 422 | - (void)addTags:(NSArray *)tags{ 423 | _isInit=YES; 424 | for (NSString *tag in tags) 425 | { 426 | [self addTagToLast:tag]; 427 | } 428 | [self layoutTagviews]; 429 | _isInit=NO; 430 | } 431 | - (void)addTags:(NSArray *)tags selectedTags:(NSArray*)selectedTags{ 432 | [self addTags:tags]; 433 | self.tagStringsSelected=[NSMutableArray arrayWithArray:selectedTags]; 434 | } 435 | - (void)addTagToLast:(NSString *)tag{ 436 | NSArray *result = [_tagStrings filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF == %@", tag]]; 437 | if (result.count == 0) 438 | { 439 | [_tagStrings addObject:tag]; 440 | 441 | EYCheckBoxButton* tagButton=[self tagButtonWithTag:tag]; 442 | [tagButton addTarget:self action:@selector(handlerButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 443 | [_svContainer addSubview:tagButton]; 444 | [_tagButtons addObject:tagButton]; 445 | 446 | switch (_type) { 447 | case EYTagView_Type_Single_Selected: 448 | case EYTagView_Type_Multi_Selected: 449 | { 450 | tagButton.selected=NO; 451 | } 452 | break; 453 | default: 454 | break; 455 | } 456 | } 457 | [self layoutTagviews]; 458 | } 459 | - (void)removeAllTags{ 460 | _isInit=YES; 461 | [_tagStrings removeAllObjects]; 462 | for (UIView* v in _tagArrows) { 463 | [v removeFromSuperview]; 464 | } 465 | [_tagArrows removeAllObjects]; 466 | for (UIButton* bt in _tagButtons) { 467 | [bt removeFromSuperview]; 468 | 469 | } 470 | [_tagButtons removeAllObjects]; 471 | [self layoutTagviews]; 472 | _isInit=NO; 473 | } 474 | - (void)removeTags:(NSArray *)tags{ 475 | for (NSString *tag in tags) 476 | { 477 | [self removeTag:tag]; 478 | } 479 | [self layoutTagviews]; 480 | } 481 | - (void)removeTagWithIndex:(NSInteger)index{ 482 | [self removeTag:_tagStrings[index]]; 483 | } 484 | - (void)removeTag:(NSString *)tag{ 485 | NSArray *result = [_tagStrings filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF == %@", tag]]; 486 | if (result) 487 | { 488 | NSInteger index=[_tagStrings indexOfObject:tag]; 489 | [_tagStrings removeObjectAtIndex:index]; 490 | [_tagButtons[index] removeFromSuperview]; 491 | [_tagButtons removeObjectAtIndex:index]; 492 | } 493 | [self layoutTagviews]; 494 | } 495 | 496 | 497 | -(void)handlerButtonAction:(EYCheckBoxButton*)tagButton{ 498 | switch (_type) { 499 | case EYTagView_Type_Edit: 500 | case EYTagView_Type_Edit_Only_Delete: 501 | { 502 | [self becomeFirstResponder]; 503 | _editingTagIndex=[_tagButtons indexOfObject:tagButton]; 504 | CGRect buttonFrame=tagButton.frame; 505 | buttonFrame.size.height-=5; 506 | 507 | UIMenuController *menuController = [UIMenuController sharedMenuController]; 508 | UIMenuItem *resetMenuItem = [[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(deleteItemClicked:)]; 509 | 510 | NSAssert([self becomeFirstResponder], @"Sorry, UIMenuController will not work with %@ since it cannot become first responder", self); 511 | [menuController setMenuItems:[NSArray arrayWithObject:resetMenuItem]]; 512 | [menuController setTargetRect:buttonFrame inView:_svContainer]; 513 | [menuController setMenuVisible:YES animated:YES]; 514 | } 515 | break; 516 | case EYTagView_Type_Single_Selected: 517 | { 518 | if (tagButton.selected) { 519 | tagButton.selected=NO; 520 | }else{ 521 | for (EYCheckBoxButton* button in _tagButtons) { 522 | button.selected=NO; 523 | } 524 | tagButton.colorBg=_colorTagBg; 525 | tagButton.selected=YES; 526 | } 527 | } 528 | break; 529 | case EYTagView_Type_Multi_Selected: 530 | { 531 | tagButton.selected=!tagButton.selected; 532 | //如果有标签数量选择限制 533 | if (_maxSelected != 0) { 534 | if (tagButton.selected == YES) { 535 | _tagButtonSelecteds += 1; 536 | }else if(tagButton.selected == NO){ 537 | _tagButtonSelecteds -= 1; 538 | } 539 | if (_tagButtonSelecteds > _maxSelected) { 540 | tagButton.selected=!tagButton.selected; 541 | UIAlertView* alert=[[UIAlertView alloc]initWithTitle:nil message:[NSString stringWithFormat:@"您最多只能选择%ld个标签",_maxSelected] delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil]; 542 | [alert show]; 543 | _tagButtonSelecteds -= 1; 544 | } 545 | } 546 | } 547 | break; 548 | case EYTagView_Type_Multi_Selected_Edit: 549 | { 550 | tagButton.selected=!tagButton.selected; 551 | } 552 | break; 553 | default: 554 | { 555 | 556 | } 557 | break; 558 | } 559 | 560 | } 561 | 562 | -(void)finishEditing{ 563 | if ((_type==EYTagView_Type_Edit || _type==EYTagView_Type_Multi_Selected_Edit) && 564 | _tfInput.isFirstResponder && _tfInput.text) { 565 | NSString* pureStr=[_tfInput.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 566 | if (pureStr 567 | && ![pureStr isEqualToString:@""]) { 568 | [self addTagToLast:pureStr]; 569 | _tfInput.text=nil; 570 | [self layoutTagviews]; 571 | 572 | } 573 | } 574 | [self.tfInput resignFirstResponder]; 575 | } 576 | 577 | -(NSArray *)getTagTexts{ 578 | NSMutableArray *texts = [NSMutableArray array]; 579 | for (UIButton *bt in self.tagButtons) { 580 | if (bt.selected) { 581 | [texts addObject:bt.titleLabel.text]; 582 | } 583 | } 584 | return [NSArray arrayWithArray:texts]; 585 | } 586 | 587 | #pragma mark UITextFieldDelegate 588 | 589 | 590 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { 591 | [textField resignFirstResponder]; 592 | if (!textField.text 593 | || [textField.text isEqualToString:@""]) { 594 | return NO; 595 | } 596 | [self addTagToLast:textField.text]; 597 | textField.text=nil; 598 | [self layoutTagviews]; 599 | return NO; 600 | } 601 | 602 | -(void)textFieldDidChange:(UITextField*)textField{ 603 | [self layoutTagviews]; 604 | } 605 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { 606 | 607 | NSString* sting2= [textField.text stringByReplacingCharactersInRange:range withString:string]; 608 | 609 | CGRect frame=_tfInput.frame; 610 | frame.size.width = [sting2 sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2; 611 | frame.size.width=MAX(frame.size.width, [EYLOCALSTRING(@"Add Tag") sizeWithAttributes:@{NSFontAttributeName:_fontInput}].width + (_tfInput.layer.cornerRadius * 2.0f) + _textPaddingSize.width*2); 612 | 613 | if (frame.size.width+_tagPaddingSize.width*2>_svContainer.contentSize.width) { 614 | NSLog(@"!!! _tfInput width tooooooooo large"); 615 | return NO; 616 | } 617 | else{ 618 | return YES; 619 | } 620 | } 621 | -(void)textFieldDidBeginEditing:(UITextField *)textField{ 622 | if (_delegate && [_delegate respondsToSelector:@selector(tagDidBeginEditing:)]) { 623 | [_delegate tagDidBeginEditing:self]; 624 | } 625 | } 626 | 627 | 628 | -(void)textFieldDidEndEditing:(UITextField *)textField{ 629 | if (_delegate && [_delegate respondsToSelector:@selector(tagDidEndEditing:)]) { 630 | [_delegate tagDidEndEditing:self]; 631 | } 632 | } 633 | #pragma mark UIMenuController 634 | 635 | - (void) deleteItemClicked:(id) sender { 636 | if (_delegate && [_delegate respondsToSelector:@selector(willRemoveTag:index:)]) { 637 | if ([_delegate willRemoveTag:self index:_editingTagIndex]) { 638 | [self removeTag:_tagStrings[_editingTagIndex]]; 639 | } 640 | } 641 | } 642 | - (BOOL) canPerformAction:(SEL)selector withSender:(id) sender { 643 | if (selector == @selector(deleteItemClicked:) /*|| selector == @selector(copy:)*/ /*<--enable that if you want the copy item */) { 644 | return YES; 645 | } 646 | return NO; 647 | } 648 | - (BOOL) canBecomeFirstResponder { 649 | return YES; 650 | } 651 | - (void)handlerTapGesture:(UIPanGestureRecognizer *)recognizer { 652 | [[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES]; 653 | if ((_type==EYTagView_Type_Edit || _type==EYTagView_Type_Multi_Selected_Edit) 654 | && _tfInput.isFirstResponder 655 | && _tfInput.text) { 656 | NSString* pureStr=[_tfInput.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 657 | if (pureStr 658 | && ![pureStr isEqualToString:@""]) { 659 | [self addTagToLast:pureStr]; 660 | _tfInput.text=nil; 661 | [self layoutTagviews]; 662 | 663 | } 664 | } 665 | } 666 | #pragma mark getter & setter 667 | -(void)setBackgroundColor:(UIColor *)backgroundColor{ 668 | [super setBackgroundColor:backgroundColor]; 669 | _svContainer.backgroundColor=backgroundColor; 670 | } 671 | -(void)setType:(EYTagView_Type)type{ 672 | _type=type; 673 | if (_type==EYTagView_Type_Display 674 | || _type==EYTagView_Type_Flow) { 675 | self.userInteractionEnabled=NO; 676 | }else{ 677 | self.userInteractionEnabled=YES; 678 | } 679 | 680 | switch (_type) { 681 | case EYTagView_Type_Edit: 682 | case EYTagView_Type_Edit_Only_Delete: 683 | { 684 | for (UIButton* button in _tagButtons) { 685 | button.selected=YES; 686 | } 687 | } 688 | break; 689 | case EYTagView_Type_Display: 690 | { 691 | for (UIButton* button in _tagButtons) { 692 | button.selected=YES; 693 | } 694 | } 695 | break; 696 | case EYTagView_Type_Single_Selected: 697 | { 698 | for (UIButton* button in _tagButtons) { 699 | button.selected=[_tagStringsSelected containsObject:button.titleLabel.text]; 700 | } 701 | } 702 | break; 703 | case EYTagView_Type_Multi_Selected: 704 | { 705 | for (UIButton* button in _tagButtons) { 706 | button.selected=[_tagStringsSelected containsObject:button.titleLabel.text]; 707 | } 708 | } 709 | break; 710 | default: 711 | { 712 | 713 | } 714 | break; 715 | } 716 | [self layoutTagviews]; 717 | } 718 | -(void)setColorTagBg:(UIColor *)colorTagBg{ 719 | _colorTagBg=colorTagBg; 720 | for (EYCheckBoxButton* button in _tagButtons) { 721 | button.colorBg=colorTagBg; 722 | } 723 | } 724 | -(void)setColorTag:(UIColor *)colorTag{ 725 | _colorTag=colorTag; 726 | for (EYCheckBoxButton* button in _tagButtons) { 727 | button.colorText=colorTag; 728 | } 729 | } 730 | -(void)setTagStringsSelected:(NSMutableArray *)tagStringsSelected{ 731 | _tagStringsSelected=tagStringsSelected; 732 | switch (_type) { 733 | case EYTagView_Type_Single_Selected: 734 | case EYTagView_Type_Multi_Selected: 735 | { 736 | for (UIButton* button in _tagButtons) { 737 | button.selected=[tagStringsSelected containsObject:button.titleLabel.text]; 738 | } 739 | } 740 | break; 741 | default: 742 | { 743 | 744 | } 745 | break; 746 | } 747 | } 748 | #pragma mark autolayout 749 | -(CGSize)intrinsicContentSize{//UIViewNoIntrinsicMetric 750 | if (_numberOfLines==0) { 751 | return CGSizeMake(UIViewNoIntrinsicMetric, _newHeight); 752 | } else { 753 | return CGSizeMake((_tagPaddingSize.height+_tagHeight)*_numberOfLines+_tagPaddingSize.height, _newHeight); 754 | } 755 | } 756 | -(void)layoutSubviews{ 757 | [self layoutTagviews]; 758 | } 759 | @end 760 | -------------------------------------------------------------------------------- /EYTagView/EYTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // EYTextField.h 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/14/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EYTextField : UITextField 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EYTagView/EYTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTextField.m 3 | // EYPopupView_Example 4 | // 5 | // Created by ericyang on 8/14/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "EYTextField.h" 10 | 11 | @implementation EYTextField 12 | 13 | // placeholder position 14 | - (CGRect)textRectForBounds:(CGRect)bounds { 15 | return CGRectInset( bounds , 9 , 0 ); 16 | } 17 | 18 | // text position 19 | - (CGRect)editingRectForBounds:(CGRect)bounds { 20 | return CGRectInset( bounds , 9 , 0 ); 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5F3FDF9C1B77248B00DE721B /* EYTagView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F3FDF9B1B77248B00DE721B /* EYTagView.m */; }; 11 | 5F4923191BC9F2CD00C23CE1 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F4923181BC9F2CD00C23CE1 /* TableViewController.m */; settings = {ASSET_TAGS = (); }; }; 12 | 5FE358CB1B770259007D66B3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5FE358CA1B770259007D66B3 /* main.m */; }; 13 | 5FE358CE1B770259007D66B3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5FE358CD1B770259007D66B3 /* AppDelegate.m */; }; 14 | 5FE358D11B770259007D66B3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5FE358D01B770259007D66B3 /* ViewController.m */; }; 15 | 5FE358D41B770259007D66B3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5FE358D21B770259007D66B3 /* Main.storyboard */; }; 16 | 5FE358D61B770259007D66B3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5FE358D51B770259007D66B3 /* Images.xcassets */; }; 17 | 5FE358D91B770259007D66B3 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5FE358D71B770259007D66B3 /* LaunchScreen.xib */; }; 18 | 5FE358E51B770259007D66B3 /* EYTagView_ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5FE358E41B770259007D66B3 /* EYTagView_ExampleTests.m */; }; 19 | 5FE9C34C1B8F542B00868E32 /* EYTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5FE9C34B1B8F542B00868E32 /* EYTextField.m */; }; 20 | 5FE9C3541B8F5D4300868E32 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5FE9C3561B8F5D4300868E32 /* Localizable.strings */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 5FE358DF1B770259007D66B3 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 5FE358BD1B770259007D66B3 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 5FE358C41B770259007D66B3; 29 | remoteInfo = EYTagView_Example; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 5F3FDF9A1B77248B00DE721B /* EYTagView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYTagView.h; sourceTree = ""; }; 35 | 5F3FDF9B1B77248B00DE721B /* EYTagView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYTagView.m; sourceTree = ""; }; 36 | 5F4923171BC9F2CD00C23CE1 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; 37 | 5F4923181BC9F2CD00C23CE1 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; 38 | 5FE358C51B770259007D66B3 /* EYTagView_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EYTagView_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 5FE358C91B770259007D66B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 5FE358CA1B770259007D66B3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | 5FE358CC1B770259007D66B3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 5FE358CD1B770259007D66B3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 5FE358CF1B770259007D66B3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 44 | 5FE358D01B770259007D66B3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 45 | 5FE358D31B770259007D66B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 5FE358D51B770259007D66B3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 47 | 5FE358D81B770259007D66B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 48 | 5FE358DE1B770259007D66B3 /* EYTagView_ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EYTagView_ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 5FE358E31B770259007D66B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 5FE358E41B770259007D66B3 /* EYTagView_ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EYTagView_ExampleTests.m; sourceTree = ""; }; 51 | 5FE9C34A1B8F542B00868E32 /* EYTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EYTextField.h; sourceTree = ""; }; 52 | 5FE9C34B1B8F542B00868E32 /* EYTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EYTextField.m; sourceTree = ""; }; 53 | 5FE9C3521B8F5CD600868E32 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = ""; }; 54 | 5FE9C3531B8F5CD600868E32 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; 55 | 5FE9C3551B8F5D4300868E32 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 56 | 5FE9C3571B8F5D4500868E32 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 5FE358C21B770259007D66B3 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 5FE358DB1B770259007D66B3 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 5F3FDF991B77248B00DE721B /* EYTagView */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 5F3FDF9A1B77248B00DE721B /* EYTagView.h */, 81 | 5F3FDF9B1B77248B00DE721B /* EYTagView.m */, 82 | 5FE9C34A1B8F542B00868E32 /* EYTextField.h */, 83 | 5FE9C34B1B8F542B00868E32 /* EYTextField.m */, 84 | ); 85 | name = EYTagView; 86 | path = ../EYTagView; 87 | sourceTree = ""; 88 | }; 89 | 5FE358BC1B770259007D66B3 = { 90 | isa = PBXGroup; 91 | children = ( 92 | 5F3FDF991B77248B00DE721B /* EYTagView */, 93 | 5FE358C71B770259007D66B3 /* EYTagView_Example */, 94 | 5FE358E11B770259007D66B3 /* EYTagView_ExampleTests */, 95 | 5FE358C61B770259007D66B3 /* Products */, 96 | ); 97 | sourceTree = ""; 98 | }; 99 | 5FE358C61B770259007D66B3 /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 5FE358C51B770259007D66B3 /* EYTagView_Example.app */, 103 | 5FE358DE1B770259007D66B3 /* EYTagView_ExampleTests.xctest */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | 5FE358C71B770259007D66B3 /* EYTagView_Example */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 5FE9C3561B8F5D4300868E32 /* Localizable.strings */, 112 | 5FE358CC1B770259007D66B3 /* AppDelegate.h */, 113 | 5FE358CD1B770259007D66B3 /* AppDelegate.m */, 114 | 5FE358CF1B770259007D66B3 /* ViewController.h */, 115 | 5FE358D01B770259007D66B3 /* ViewController.m */, 116 | 5F4923171BC9F2CD00C23CE1 /* TableViewController.h */, 117 | 5F4923181BC9F2CD00C23CE1 /* TableViewController.m */, 118 | 5FE358D21B770259007D66B3 /* Main.storyboard */, 119 | 5FE358D51B770259007D66B3 /* Images.xcassets */, 120 | 5FE358D71B770259007D66B3 /* LaunchScreen.xib */, 121 | 5FE358C81B770259007D66B3 /* Supporting Files */, 122 | ); 123 | path = EYTagView_Example; 124 | sourceTree = ""; 125 | }; 126 | 5FE358C81B770259007D66B3 /* Supporting Files */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 5FE358C91B770259007D66B3 /* Info.plist */, 130 | 5FE358CA1B770259007D66B3 /* main.m */, 131 | ); 132 | name = "Supporting Files"; 133 | sourceTree = ""; 134 | }; 135 | 5FE358E11B770259007D66B3 /* EYTagView_ExampleTests */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 5FE358E41B770259007D66B3 /* EYTagView_ExampleTests.m */, 139 | 5FE358E21B770259007D66B3 /* Supporting Files */, 140 | ); 141 | path = EYTagView_ExampleTests; 142 | sourceTree = ""; 143 | }; 144 | 5FE358E21B770259007D66B3 /* Supporting Files */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 5FE358E31B770259007D66B3 /* Info.plist */, 148 | ); 149 | name = "Supporting Files"; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | 5FE358C41B770259007D66B3 /* EYTagView_Example */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 5FE358E81B770259007D66B3 /* Build configuration list for PBXNativeTarget "EYTagView_Example" */; 158 | buildPhases = ( 159 | 5FE358C11B770259007D66B3 /* Sources */, 160 | 5FE358C21B770259007D66B3 /* Frameworks */, 161 | 5FE358C31B770259007D66B3 /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = EYTagView_Example; 168 | productName = EYTagView_Example; 169 | productReference = 5FE358C51B770259007D66B3 /* EYTagView_Example.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | 5FE358DD1B770259007D66B3 /* EYTagView_ExampleTests */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 5FE358EB1B770259007D66B3 /* Build configuration list for PBXNativeTarget "EYTagView_ExampleTests" */; 175 | buildPhases = ( 176 | 5FE358DA1B770259007D66B3 /* Sources */, 177 | 5FE358DB1B770259007D66B3 /* Frameworks */, 178 | 5FE358DC1B770259007D66B3 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | 5FE358E01B770259007D66B3 /* PBXTargetDependency */, 184 | ); 185 | name = EYTagView_ExampleTests; 186 | productName = EYTagView_ExampleTests; 187 | productReference = 5FE358DE1B770259007D66B3 /* EYTagView_ExampleTests.xctest */; 188 | productType = "com.apple.product-type.bundle.unit-test"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 5FE358BD1B770259007D66B3 /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastUpgradeCheck = 0640; 197 | ORGANIZATIONNAME = "Eric Yang"; 198 | TargetAttributes = { 199 | 5FE358C41B770259007D66B3 = { 200 | CreatedOnToolsVersion = 6.4; 201 | DevelopmentTeam = 77SM2DKNM6; 202 | }; 203 | 5FE358DD1B770259007D66B3 = { 204 | CreatedOnToolsVersion = 6.4; 205 | TestTargetID = 5FE358C41B770259007D66B3; 206 | }; 207 | }; 208 | }; 209 | buildConfigurationList = 5FE358C01B770259007D66B3 /* Build configuration list for PBXProject "EYTagView_Example" */; 210 | compatibilityVersion = "Xcode 3.2"; 211 | developmentRegion = English; 212 | hasScannedForEncodings = 0; 213 | knownRegions = ( 214 | en, 215 | Base, 216 | "zh-Hans", 217 | ); 218 | mainGroup = 5FE358BC1B770259007D66B3; 219 | productRefGroup = 5FE358C61B770259007D66B3 /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | 5FE358C41B770259007D66B3 /* EYTagView_Example */, 224 | 5FE358DD1B770259007D66B3 /* EYTagView_ExampleTests */, 225 | ); 226 | }; 227 | /* End PBXProject section */ 228 | 229 | /* Begin PBXResourcesBuildPhase section */ 230 | 5FE358C31B770259007D66B3 /* Resources */ = { 231 | isa = PBXResourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | 5FE358D41B770259007D66B3 /* Main.storyboard in Resources */, 235 | 5FE9C3541B8F5D4300868E32 /* Localizable.strings in Resources */, 236 | 5FE358D91B770259007D66B3 /* LaunchScreen.xib in Resources */, 237 | 5FE358D61B770259007D66B3 /* Images.xcassets in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 5FE358DC1B770259007D66B3 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | /* End PBXResourcesBuildPhase section */ 249 | 250 | /* Begin PBXSourcesBuildPhase section */ 251 | 5FE358C11B770259007D66B3 /* Sources */ = { 252 | isa = PBXSourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | 5FE9C34C1B8F542B00868E32 /* EYTextField.m in Sources */, 256 | 5F4923191BC9F2CD00C23CE1 /* TableViewController.m in Sources */, 257 | 5FE358D11B770259007D66B3 /* ViewController.m in Sources */, 258 | 5FE358CE1B770259007D66B3 /* AppDelegate.m in Sources */, 259 | 5FE358CB1B770259007D66B3 /* main.m in Sources */, 260 | 5F3FDF9C1B77248B00DE721B /* EYTagView.m in Sources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | 5FE358DA1B770259007D66B3 /* Sources */ = { 265 | isa = PBXSourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | 5FE358E51B770259007D66B3 /* EYTagView_ExampleTests.m in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXSourcesBuildPhase section */ 273 | 274 | /* Begin PBXTargetDependency section */ 275 | 5FE358E01B770259007D66B3 /* PBXTargetDependency */ = { 276 | isa = PBXTargetDependency; 277 | target = 5FE358C41B770259007D66B3 /* EYTagView_Example */; 278 | targetProxy = 5FE358DF1B770259007D66B3 /* PBXContainerItemProxy */; 279 | }; 280 | /* End PBXTargetDependency section */ 281 | 282 | /* Begin PBXVariantGroup section */ 283 | 5FE358D21B770259007D66B3 /* Main.storyboard */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 5FE358D31B770259007D66B3 /* Base */, 287 | 5FE9C3521B8F5CD600868E32 /* zh-Hans */, 288 | ); 289 | name = Main.storyboard; 290 | sourceTree = ""; 291 | }; 292 | 5FE358D71B770259007D66B3 /* LaunchScreen.xib */ = { 293 | isa = PBXVariantGroup; 294 | children = ( 295 | 5FE358D81B770259007D66B3 /* Base */, 296 | 5FE9C3531B8F5CD600868E32 /* zh-Hans */, 297 | ); 298 | name = LaunchScreen.xib; 299 | sourceTree = ""; 300 | }; 301 | 5FE9C3561B8F5D4300868E32 /* Localizable.strings */ = { 302 | isa = PBXVariantGroup; 303 | children = ( 304 | 5FE9C3551B8F5D4300868E32 /* en */, 305 | 5FE9C3571B8F5D4500868E32 /* zh-Hans */, 306 | ); 307 | name = Localizable.strings; 308 | sourceTree = ""; 309 | }; 310 | /* End PBXVariantGroup section */ 311 | 312 | /* Begin XCBuildConfiguration section */ 313 | 5FE358E61B770259007D66B3 /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ALWAYS_SEARCH_USER_PATHS = NO; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INT_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | GCC_C_LANGUAGE_STANDARD = gnu99; 335 | GCC_DYNAMIC_NO_PIC = NO; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_OPTIMIZATION_LEVEL = 0; 338 | GCC_PREPROCESSOR_DEFINITIONS = ( 339 | "DEBUG=1", 340 | "$(inherited)", 341 | ); 342 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | }; 354 | name = Debug; 355 | }; 356 | 5FE358E71B770259007D66B3 /* Release */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ALWAYS_SEARCH_USER_PATHS = NO; 360 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 361 | CLANG_CXX_LIBRARY = "libc++"; 362 | CLANG_ENABLE_MODULES = YES; 363 | CLANG_ENABLE_OBJC_ARC = YES; 364 | CLANG_WARN_BOOL_CONVERSION = YES; 365 | CLANG_WARN_CONSTANT_CONVERSION = YES; 366 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 367 | CLANG_WARN_EMPTY_BODY = YES; 368 | CLANG_WARN_ENUM_CONVERSION = YES; 369 | CLANG_WARN_INT_CONVERSION = YES; 370 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 371 | CLANG_WARN_UNREACHABLE_CODE = YES; 372 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 373 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 374 | COPY_PHASE_STRIP = NO; 375 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 376 | ENABLE_NS_ASSERTIONS = NO; 377 | ENABLE_STRICT_OBJC_MSGSEND = YES; 378 | GCC_C_LANGUAGE_STANDARD = gnu99; 379 | GCC_NO_COMMON_BLOCKS = YES; 380 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 387 | MTL_ENABLE_DEBUG_INFO = NO; 388 | SDKROOT = iphoneos; 389 | VALIDATE_PRODUCT = YES; 390 | }; 391 | name = Release; 392 | }; 393 | 5FE358E91B770259007D66B3 /* Debug */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 397 | CODE_SIGN_IDENTITY = "iPhone Distribution: YANG WEI (77SM2DKNM6)"; 398 | INFOPLIST_FILE = EYTagView_Example/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | }; 402 | name = Debug; 403 | }; 404 | 5FE358EA1B770259007D66B3 /* Release */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 408 | CODE_SIGN_IDENTITY = "iPhone Distribution: YANG WEI (77SM2DKNM6)"; 409 | INFOPLIST_FILE = EYTagView_Example/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | }; 413 | name = Release; 414 | }; 415 | 5FE358EC1B770259007D66B3 /* Debug */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | BUNDLE_LOADER = "$(TEST_HOST)"; 419 | FRAMEWORK_SEARCH_PATHS = ( 420 | "$(SDKROOT)/Developer/Library/Frameworks", 421 | "$(inherited)", 422 | ); 423 | GCC_PREPROCESSOR_DEFINITIONS = ( 424 | "DEBUG=1", 425 | "$(inherited)", 426 | ); 427 | INFOPLIST_FILE = EYTagView_ExampleTests/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EYTagView_Example.app/EYTagView_Example"; 431 | }; 432 | name = Debug; 433 | }; 434 | 5FE358ED1B770259007D66B3 /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | BUNDLE_LOADER = "$(TEST_HOST)"; 438 | FRAMEWORK_SEARCH_PATHS = ( 439 | "$(SDKROOT)/Developer/Library/Frameworks", 440 | "$(inherited)", 441 | ); 442 | INFOPLIST_FILE = EYTagView_ExampleTests/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 444 | PRODUCT_NAME = "$(TARGET_NAME)"; 445 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EYTagView_Example.app/EYTagView_Example"; 446 | }; 447 | name = Release; 448 | }; 449 | /* End XCBuildConfiguration section */ 450 | 451 | /* Begin XCConfigurationList section */ 452 | 5FE358C01B770259007D66B3 /* Build configuration list for PBXProject "EYTagView_Example" */ = { 453 | isa = XCConfigurationList; 454 | buildConfigurations = ( 455 | 5FE358E61B770259007D66B3 /* Debug */, 456 | 5FE358E71B770259007D66B3 /* Release */, 457 | ); 458 | defaultConfigurationIsVisible = 0; 459 | defaultConfigurationName = Release; 460 | }; 461 | 5FE358E81B770259007D66B3 /* Build configuration list for PBXNativeTarget "EYTagView_Example" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | 5FE358E91B770259007D66B3 /* Debug */, 465 | 5FE358EA1B770259007D66B3 /* Release */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | 5FE358EB1B770259007D66B3 /* Build configuration list for PBXNativeTarget "EYTagView_ExampleTests" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | 5FE358EC1B770259007D66B3 /* Debug */, 474 | 5FE358ED1B770259007D66B3 /* Release */, 475 | ); 476 | defaultConfigurationIsVisible = 0; 477 | defaultConfigurationName = Release; 478 | }; 479 | /* End XCConfigurationList section */ 480 | }; 481 | rootObject = 5FE358BD1B770259007D66B3 /* Project object */; 482 | } 483 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 66 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.appcpu.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/TableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.h 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 10/11/15. 6 | // Copyright © 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/TableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.m 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 10/11/15. 6 | // Copyright © 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "TableViewController.h" 10 | #import "ViewController.h" 11 | #import "EYTagView.h" 12 | 13 | @interface TableViewController () 14 | 15 | @end 16 | 17 | @implementation TableViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | // Uncomment the following line to preserve selection between presentations. 23 | // self.clearsSelectionOnViewWillAppear = NO; 24 | 25 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 26 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 27 | } 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ 34 | NSIndexPath* indexPath=[self.tableView indexPathForSelectedRow]; 35 | ViewController* vc= segue.destinationViewController; 36 | 37 | vc.type=indexPath.row%(EYTagView_Type_Flow+1); 38 | } 39 | #pragma mark - Table view data source 40 | 41 | 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 43 | return EYTagView_Type_Flow+1; 44 | } 45 | 46 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath { 47 | [self performSegueWithIdentifier:@"Segue" sender:self]; 48 | } 49 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 50 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 51 | 52 | // Configure the cell... 53 | switch (indexPath.row) { 54 | case 0: 55 | { 56 | cell.textLabel.text=@"EYTagView_Type_Edit"; 57 | } 58 | break; 59 | case 1: 60 | { 61 | cell.textLabel.text=@"EYTagView_Type_Edit_Only_Delete"; 62 | } 63 | break; 64 | case 2: 65 | { 66 | cell.textLabel.text=@"EYTagView_Type_Display"; 67 | } 68 | break; 69 | case 3: 70 | { 71 | cell.textLabel.text=@"EYTagView_Type_Single_Selected"; 72 | } 73 | break; 74 | case 4: 75 | { 76 | cell.textLabel.text=@"EYTagView_Type_Multi_Selected"; 77 | } 78 | break; 79 | case 5: 80 | { 81 | cell.textLabel.text=@"EYTagView_Type_Multi_Selected_Edit"; 82 | } 83 | break; 84 | case 6: 85 | { 86 | cell.textLabel.text=@"EYTagView_Type_Flow"; 87 | } 88 | break; 89 | } 90 | return cell; 91 | } 92 | 93 | 94 | /* 95 | // Override to support conditional editing of the table view. 96 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 97 | // Return NO if you do not want the specified item to be editable. 98 | return YES; 99 | } 100 | */ 101 | 102 | /* 103 | // Override to support editing the table view. 104 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 105 | if (editingStyle == UITableViewCellEditingStyleDelete) { 106 | // Delete the row from the data source 107 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 108 | } else if (editingStyle == UITableViewCellEditingStyleInsert) { 109 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 110 | } 111 | } 112 | */ 113 | 114 | /* 115 | // Override to support rearranging the table view. 116 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { 117 | } 118 | */ 119 | 120 | /* 121 | // Override to support conditional rearranging of the table view. 122 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { 123 | // Return NO if you do not want the item to be re-orderable. 124 | return YES; 125 | } 126 | */ 127 | 128 | /* 129 | #pragma mark - Navigation 130 | 131 | // In a storyboard-based application, you will often want to do a little preparation before navigation 132 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 133 | // Get the new view controller using [segue destinationViewController]. 134 | // Pass the selected object to the new view controller. 135 | } 136 | */ 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EYTagView.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property (nonatomic) EYTagView_Type type; 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | /** 11 | @[ 12 | @"dog", 13 | @"cat", 14 | @"pig", 15 | @"duck", 16 | @"horse", 17 | @"elephant", 18 | @"ant", 19 | @"fish", 20 | @"bird", 21 | @"engle", 22 | @"snake", 23 | @"mouse", 24 | @"squirrel", 25 | @"beaver", 26 | @"kangaroo", 27 | @"monkey", 28 | @"panda", 29 | @"bear", 30 | @"lion", 31 | ] 32 | */ 33 | 34 | @interface ViewController () 35 | @property (strong, nonatomic) IBOutlet EYTagView *tagView; 36 | @property (strong, nonatomic) IBOutlet EYTagView *tagView2; 37 | 38 | @end 39 | 40 | @implementation ViewController 41 | 42 | - (void)viewDidLoad { 43 | [super viewDidLoad]; 44 | 45 | { 46 | EYTagView* tagView=_tagView; 47 | tagView.colorTag=COLORRGB(0xffffff); 48 | tagView.colorTagBg=COLORRGB(0x2ab44e); 49 | tagView.colorInput=COLORRGB(0x2ab44e); 50 | tagView.colorInputBg=COLORRGB(0xffffff); 51 | tagView.colorInputPlaceholder=COLORRGB(0x2ab44e); 52 | tagView.backgroundColor=COLORRGB(0x00ffff); 53 | tagView.colorInputBoard=COLORRGB(0x2ab44e); 54 | tagView.viewMaxHeight=230; 55 | tagView.type=_type; 56 | 57 | [tagView addTags:@[ 58 | @"dog", 59 | @"cat", 60 | @"pig", 61 | @"duck", 62 | @"horse", 63 | @"elephant", 64 | @"ant", 65 | @"fish", 66 | @"bird", 67 | @"engle", 68 | @"snake", 69 | @"mouse", 70 | @"squirrel", 71 | @"beaver", 72 | @"kangaroo", 73 | @"monkey", 74 | @"panda", 75 | @"bear", 76 | @"lion", 77 | ]]; 78 | } 79 | 80 | { 81 | EYTagView* tagView=_tagView2; 82 | 83 | tagView.colorTag=COLORRGB(0xffffff); 84 | tagView.colorTagBg=COLORRGB(0x2ab44e); 85 | tagView.colorInput=COLORRGB(0x2ab44e); 86 | tagView.colorInputBg=COLORRGB(0xffffff); 87 | tagView.colorInputPlaceholder=COLORRGB(0x2ab44e); 88 | tagView.backgroundColor=COLORRGB(0x00ffff); 89 | tagView.colorInputBoard=COLORRGB(0x2ab44e); 90 | 91 | tagView.type=_type; 92 | tagView.viewMaxHeight=230; 93 | 94 | [tagView addTags:@[ 95 | @"pig", 96 | @"duck", 97 | @"horse", 98 | @"elephant", 99 | @"ant", 100 | @"fish", 101 | ]]; 102 | } 103 | 104 | 105 | } 106 | 107 | 108 | 109 | -(void)heightDidChangedTagView:(EYTagView *)tagView{ 110 | NSLog(@"heightDidChangedTagView"); 111 | } 112 | - (IBAction)toggleType:(UISwitch*)sender { 113 | _tagView.type=sender.on?EYTagView_Type_Edit:EYTagView_Type_Display; 114 | } 115 | - (IBAction)handlerSegmentAction:(UISegmentedControl*)sender { 116 | _tagView.type=(EYTagView_Type)sender.selectedSegmentIndex; 117 | switch (sender.selectedSegmentIndex) { 118 | case 0: 119 | { 120 | 121 | } 122 | break; 123 | case 1: 124 | { 125 | 126 | } 127 | break; 128 | case 2: 129 | { 130 | 131 | } 132 | break; 133 | case 3: 134 | { 135 | 136 | } 137 | break; 138 | 139 | default: 140 | break; 141 | } 142 | 143 | 144 | } 145 | - (IBAction)test:(id)sender { 146 | NSLog(@"%@",_tagView); 147 | } 148 | @end 149 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Add Tag"="Add Tag"; 2 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EYTagView_Example 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/zh-Hans.lproj/LaunchScreen.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = " Copyright (c) 2015 Eric Yang. All rights reserved."; ObjectID = "8ie-xW-0ye"; */ 3 | "8ie-xW-0ye.text" = " Copyright (c) 2015 Eric Yang. All rights reserved."; 4 | 5 | /* Class = "UILabel"; text = "EYTagView_Example"; ObjectID = "kId-c2-rCX"; */ 6 | "kId-c2-rCX.text" = "EYTagView_Example"; 7 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Add Tag"="添加标签"; 2 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_Example/zh-Hans.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = "auto layout test"; ObjectID = "LVG-rX-BcK"; */ 3 | "LVG-rX-BcK.text" = "auto layout test"; 4 | 5 | /* Class = "UISegmentedControl"; gko-4U-5Zb.segmentTitles[0] = "tag edit"; ObjectID = "gko-4U-5Zb"; */ 6 | "gko-4U-5Zb.segmentTitles[0]" = "tag edit"; 7 | 8 | /* Class = "UISegmentedControl"; gko-4U-5Zb.segmentTitles[1] = "tag show"; ObjectID = "gko-4U-5Zb"; */ 9 | "gko-4U-5Zb.segmentTitles[1]" = "tag show"; 10 | 11 | /* Class = "UISegmentedControl"; gko-4U-5Zb.segmentTitles[2] = "radio"; ObjectID = "gko-4U-5Zb"; */ 12 | "gko-4U-5Zb.segmentTitles[2]" = "radio"; 13 | 14 | /* Class = "UISegmentedControl"; gko-4U-5Zb.segmentTitles[3] = "checkbox"; ObjectID = "gko-4U-5Zb"; */ 15 | "gko-4U-5Zb.segmentTitles[3]" = "checkbox"; 16 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_ExampleTests/EYTagView_ExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // EYTagView_ExampleTests.m 3 | // EYTagView_ExampleTests 4 | // 5 | // Created by ericyang on 8/9/15. 6 | // Copyright (c) 2015 Eric Yang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface EYTagView_ExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation EYTagView_ExampleTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /EYTagView_Example/EYTagView_ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.appcpu.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # EYTagView 2 | 3 | ------ 4 | 5 | EYTagView is a custome view simulate iOS Evernote's tag editing view. 6 | --- 7 | 8 | ####EYTagView is included in a more powerful project [EYPopupView](https://github.com/ygweric/EYPopupView) 9 | 10 | --- 11 | 12 | ###What can EYTagView do ??? 13 | 14 | 1. Show unlimited number of tags in EYTagView with bricks layout 15 | 16 | ![scrollable.gif](https://raw.githubusercontent.com/ygweric/EYTagView/master/screenshots/1scrollable.gif) 17 | 18 | 19 | 2. Can add and delete tag free 20 | 21 | 3. Can disable editing tags if you want 22 | 23 | ![scrollable.gif](https://raw.githubusercontent.com/ygweric/EYTagView/master/screenshots/1editable.gif) 24 | 25 | 4. You can donfig almost all color and font as yo want 26 | 27 | ``` 28 | _tagView.colorTag=COLORRGB(0xffffff); 29 | _tagView.colorTagBg=COLORRGB(0x2ab44e); 30 | _tagView.colorInput=COLORRGB(0x2ab44e); 31 | _tagView.colorInputBg=COLORRGB(0xffffff); 32 | _tagView.colorInputPlaceholder=COLORRGB(0x2ab44e); 33 | _tagView.backgroundColor=COLORRGB(0xffffff); 34 | _tagView.colorInputBoard=COLORRGB(0x2ab44e); 35 | _tagView.viewMaxHeight=130; 36 | ``` 37 | 38 | 39 | 40 | --- 41 | ### how to use EYTagView 42 | 43 | ```Object-C 44 | EYTagView* _tagView=[[EYTagView alloc]initWithFrame:CGRectMake(10, 10, 200, 200)]; 45 | [self.view addSubview:_tagView]; 46 | _tagView.delegate=self; 47 | [_tagView addTags:@[ 48 | @"111", 49 | @"222", 50 | @"犬瘟热", 51 | @"惹我欠人情无人区污染污染", 52 | @"3而是", 53 | @"是", 54 | ]]; 55 | ``` 56 | in `EYTagViewDelegate` ,the method `heightDidChangedTagView:(EYTagView *)` wil be called when the EYTagView's height is changed, so you can update the layout. 57 | 58 | --- 59 | 60 | If you are using autolayout, you dan do the following: 61 | 62 | 1. layout you view in the xib or storyboard as normal. 63 | 64 | 2. set the height and width of EYTagView to a constant value, but set the priority to <=249 ,which less that `Content Hugging priority 250` 65 | 66 | 67 | Then the _vContainer's frame will change with _tagView. 68 | 69 | --- 70 | If you don't know how to use EYTagView well, you can check the example project or create an issue 71 | 72 | -- 73 | ###EYTagView not support TableViewCell, use Header/Footer or ScrollView instead 74 | -------------------------------------------------------------------------------- /screenshots/1editable.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYTagView/ee14a945fe63ee2c6a1f6184d65bf8cf6c3d5c70/screenshots/1editable.gif -------------------------------------------------------------------------------- /screenshots/1scrollable.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygweric/EYTagView/ee14a945fe63ee2c6a1f6184d65bf8cf6c3d5c70/screenshots/1scrollable.gif --------------------------------------------------------------------------------