Latest 0.0.1
Homepage https://github.com/dawnnnnn/DNTagView
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, Foundation
Authors

DNTagView

Version
License
Platform

This library is derived from SKTagView, which tries to build a view displaying tags without using UICollectionView and supports Autolayout.

It supports to add tags by UITextField now, and using UIMenuController to delete tag.

Installation with CocoaPods

platform :ios, '8.0'
pod 'DNTagView'

Usage

Create tag view container

    self.tagView = ({ DNTagView *view = [DNTagView new];
    view.backgroundColor = [UIColor cyanColor];
    view.padding = UIEdgeInsetsMake(10, 25, 10, 25);
    view.interitemSpacing = 8;
    view.lineSpacing = 10;
    // set delegate
    view.delegate = self;
    view;
    });

Build tag

  [@[@"Python", @"Javascript", @"HTML", @"Go", @"Objective-C", @"C", @"PHP"] enumerateObjectsUsingBlock:^(NSString *text, NSUInteger idx, BOOL *stop) {
    DNTag *tag = [DNTag tagWithText:text];
    tag.textColor = [UIColor blackColor];
    tag.fontSize = 15;
    tag.padding = UIEdgeInsetsMake(5, 5, 5, 5);
    tag.bgColor = [UIColor dn_colorWithHexString:@"0x017E66" alpha:0.08];
    tag.cornerRadius = 3;
    [self.tagView addTag:tag];
  }];

Delegate – optional

- (void)didInputText:(NSString *)text {
    // you input text;
}

- (void)completeInputText:(NSString *)text {
    // clicked return key 
}

- (void)deleteTag:(NSInteger)index {
    // you have deleted the indexth tag;
}

ScreenShot

DNTagView

License

DNTagView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DNTagView",
    "version": "0.0.1",
    "summary": "DNTagView is a view supports to display tags.",
    "description": "DNTagView is a view supports to display tags with auto layout.n- supports auto layoutn- supports working with UITableViewCelln- supports adding with UITextFieldn- supports deleting with UIMenuController",
    "homepage": "https://github.com/dawnnnnn/DNTagView",
    "license": "MIT",
    "authors": {
        "dawnnnnn": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/dawnnnnn/DNTagView.git",
        "tag": "0.0.1"
    },
    "source_files": "DNTagViewDemo/TagView/*",
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This