├── Screenshot └── ss.png ├── Demo ├── ZFTokenFieldDemo.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── project.pbxproj ├── ZFTokenFieldDemo │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── AppDelegate.m │ ├── ViewController.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ └── TokenView.xib └── ZFTokenFieldDemoTests │ ├── Info.plist │ └── ZFTokenFieldDemoTests.m ├── .gitignore ├── LICENSE ├── README.md ├── Classes ├── ZFTokenField.h └── ZFTokenField.m └── ZFTokenField.podspec /Screenshot/ss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zoonooz/ZFTokenField/HEAD/Screenshot/ss.png -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ZFTokenFieldDemo 4 | // 5 | // Created by Amornchai Kanokpullwad on 11/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ZFTokenFieldDemo 4 | // 5 | // Created by Amornchai Kanokpullwad on 11/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. 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 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ZFTokenFieldDemo 4 | // 5 | // Created by Amornchai Kanokpullwad on 11/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/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 | } -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.zoonref.$(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 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemoTests/ZFTokenFieldDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZFTokenFieldDemoTests.m 3 | // ZFTokenFieldDemoTests 4 | // 5 | // Created by Amornchai Kanokpullwad on 11/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ZFTokenFieldDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ZFTokenFieldDemoTests 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Amornchai Kanokpullwad 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.zoonref.$(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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ZFTokenField 2 | ============ 3 | 4 | iOS custom view that let you add token view inside like NSTokenField 5 | 6 |

7 | 8 | ## Installation 9 | 10 | ```pod 'ZFTokenField'``` 11 | 12 | ## Usage 13 | 14 | ### ZFTokenFieldDataSource 15 | You need to implement these in your datasource class 16 | 17 | * ```lineHeightForTokenInField:tokenField:``` return desire line height. 18 | * ```numberOfTokenInField:``` return number of token that you want to display. 19 | * ```tokenField:viewForTokenAtIndex:``` return view that you want to display at specify index 20 | 21 | ### ZFTokenFieldDelegate 22 | 23 | * ```tokenMarginInTokenInField:``` your prefered margin, default is 0 24 | * ```tokenField:didRemoveTokenAtIndex:``` get called when user deletes token at particular index. 25 | * ```tokenField:didReturnWithText:``` get called when user hits return with text. 26 | * ```tokenField:didTextChanged:``` get called when user changes text. 27 | * ```tokenFieldDidBeginEditing:``` get called when user begins edit the field. 28 | * ```tokenFieldShouldEndEditing:``` get called to ask if the field should end editing. 29 | * ```tokenFieldDidEndEditing:``` get called when user stops edit the field. 30 | 31 | ## Author 32 | 33 | Amornchai Kanokpullwad, amornchai.zoon@gmail.com [@zoonref](http://twitter.com/zoonref) 34 | 35 | ## License 36 | 37 | ZFTokenField is available under the MIT license. See the LICENSE file for more info. 38 | -------------------------------------------------------------------------------- /Classes/ZFTokenField.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZFTokenField.h 3 | // ZFTokenField 4 | // 5 | // Created by Amornchai Kanokpullwad on 10/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ZFTokenField; 12 | 13 | @interface ZFTokenTextField : UITextField 14 | @end 15 | 16 | @protocol ZFTokenFieldDataSource 17 | @required 18 | - (CGFloat)lineHeightForTokenInField:(ZFTokenField *)tokenField; 19 | - (NSUInteger)numberOfTokenInField:(ZFTokenField *)tokenField; 20 | - (UIView *)tokenField:(ZFTokenField *)tokenField viewForTokenAtIndex:(NSUInteger)index; 21 | @end 22 | 23 | @protocol ZFTokenFieldDelegate 24 | @optional 25 | - (CGFloat)tokenMarginInTokenInField:(ZFTokenField *)tokenField; 26 | - (void)tokenField:(ZFTokenField *)tokenField didRemoveTokenAtIndex:(NSUInteger)index; 27 | - (void)tokenField:(ZFTokenField *)tokenField didReturnWithText:(NSString *)text; 28 | - (void)tokenField:(ZFTokenField *)tokenField didTextChanged:(NSString *)text; 29 | - (void)tokenFieldDidBeginEditing:(ZFTokenField *)tokenField; 30 | - (BOOL)tokenFieldShouldEndEditing:(ZFTokenField *)textField; 31 | - (void)tokenFieldDidEndEditing:(ZFTokenField *)tokenField; 32 | @end 33 | 34 | @interface ZFTokenField : UIControl 35 | 36 | @property (nonatomic, weak) IBOutlet id dataSource; 37 | @property (nonatomic, weak) IBOutlet id delegate; 38 | 39 | @property (nonatomic, strong, readonly) ZFTokenTextField *textField; 40 | 41 | - (void)reloadData; 42 | - (NSUInteger)numberOfToken; 43 | - (NSUInteger)indexOfTokenView:(UIView *)view; 44 | 45 | @end -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ZFTokenFieldDemo 4 | // 5 | // Created by Amornchai Kanokpullwad on 11/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. 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 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ZFTokenFieldDemo 4 | // 5 | // Created by Amornchai Kanokpullwad on 11/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "ZFTokenField.h" 11 | 12 | @interface ViewController () 13 | @property (weak, nonatomic) IBOutlet ZFTokenField *tokenField; 14 | @property (nonatomic, strong) NSMutableArray *tokens; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | 23 | self.tokens = [NSMutableArray array]; 24 | 25 | self.tokenField.dataSource = self; 26 | self.tokenField.delegate = self; 27 | self.tokenField.textField.placeholder = @"Enter here"; 28 | [self.tokenField reloadData]; 29 | 30 | [self.tokenField.textField becomeFirstResponder]; 31 | } 32 | 33 | - (IBAction)sendButtonPressed:(id)sender 34 | { 35 | self.tokens = [NSMutableArray array]; 36 | [self.tokenField reloadData]; 37 | } 38 | 39 | - (void)tokenDeleteButtonPressed:(UIButton *)tokenButton 40 | { 41 | NSUInteger index = [self.tokenField indexOfTokenView:tokenButton.superview]; 42 | if (index != NSNotFound) { 43 | [self.tokens removeObjectAtIndex:index]; 44 | [self.tokenField reloadData]; 45 | } 46 | } 47 | 48 | #pragma mark - ZFTokenField DataSource 49 | 50 | - (CGFloat)lineHeightForTokenInField:(ZFTokenField *)tokenField 51 | { 52 | return 40; 53 | } 54 | 55 | - (NSUInteger)numberOfTokenInField:(ZFTokenField *)tokenField 56 | { 57 | return self.tokens.count; 58 | } 59 | 60 | - (UIView *)tokenField:(ZFTokenField *)tokenField viewForTokenAtIndex:(NSUInteger)index 61 | { 62 | NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"TokenView" owner:nil options:nil]; 63 | UIView *view = nibContents[0]; 64 | UILabel *label = (UILabel *)[view viewWithTag:2]; 65 | UIButton *button = (UIButton *)[view viewWithTag:3]; 66 | 67 | [button addTarget:self action:@selector(tokenDeleteButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; 68 | 69 | label.text = self.tokens[index]; 70 | CGSize size = [label sizeThatFits:CGSizeMake(1000, 40)]; 71 | view.frame = CGRectMake(0, 0, size.width + 97, 40); 72 | return view; 73 | } 74 | 75 | #pragma mark - ZFTokenField Delegate 76 | 77 | - (CGFloat)tokenMarginInTokenInField:(ZFTokenField *)tokenField 78 | { 79 | return 5; 80 | } 81 | 82 | - (void)tokenField:(ZFTokenField *)tokenField didReturnWithText:(NSString *)text 83 | { 84 | [self.tokens addObject:text]; 85 | [tokenField reloadData]; 86 | } 87 | 88 | - (void)tokenField:(ZFTokenField *)tokenField didRemoveTokenAtIndex:(NSUInteger)index 89 | { 90 | [self.tokens removeObjectAtIndex:index]; 91 | } 92 | 93 | - (BOOL)tokenFieldShouldEndEditing:(ZFTokenField *)textField 94 | { 95 | return NO; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ZFTokenField.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint ZFTokenField.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "ZFTokenField" 19 | s.version = "0.0.1" 20 | s.summary = "iOS custom view that let you add token view inside like NSTokenField." 21 | s.homepage = "https://github.com/zoonooz/ZFTokenField" 22 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 23 | 24 | 25 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 26 | # 27 | # Licensing your code is important. See http://choosealicense.com for more info. 28 | # CocoaPods will detect a license file if there is a named LICENSE* 29 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 30 | # 31 | 32 | s.license = "MIT" 33 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 34 | 35 | 36 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 37 | # 38 | # Specify the authors of the library, with email addresses. Email addresses 39 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 40 | # accepts just a name if you'd rather not provide an email address. 41 | # 42 | # Specify a social_media_url where others can refer to, for example a twitter 43 | # profile URL. 44 | # 45 | 46 | s.author = { "Amornchai Kanokpullwad" => "amornchai.zoon@gmail.com" } 47 | # Or just: s.author = "Amornchai Kanokpullwad" 48 | # s.authors = { "Amornchai Kanokpullwad" => "amornchai.zoon@gmail.com" } 49 | s.social_media_url = "http://twitter.com/zoonref" 50 | 51 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 52 | # 53 | # If this Pod runs only on iOS or OS X, then specify the platform and 54 | # the deployment target. You can optionally include the target after the platform. 55 | # 56 | 57 | # s.platform = :ios 58 | s.platform = :ios, "7.1" 59 | 60 | # When using multiple platforms 61 | # s.ios.deployment_target = "5.0" 62 | # s.osx.deployment_target = "10.7" 63 | 64 | 65 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 66 | # 67 | # Specify the location from where the source should be retrieved. 68 | # Supports git, hg, bzr, svn and HTTP. 69 | # 70 | 71 | s.source = { :git => "https://github.com/zoonooz/ZFTokenField.git", :tag => "0.0.1" } 72 | 73 | 74 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 75 | # 76 | # CocoaPods is smart about how it includes source code. For source files 77 | # giving a folder will include any h, m, mm, c & cpp files. For header 78 | # files it will include any header in the folder. 79 | # Not including the public_header_files will make all headers public. 80 | # 81 | 82 | s.source_files = "Classes", "Classes/**/*.{h,m}" 83 | # s.exclude_files = "Classes/Exclude" 84 | 85 | # s.public_header_files = "Classes/**/*.h" 86 | 87 | 88 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 89 | # 90 | # A list of resources included with the Pod. These are copied into the 91 | # target bundle with a build phase script. Anything else will be cleaned. 92 | # You can preserve files from being cleaned, please don't preserve 93 | # non-essential files like tests, examples and documentation. 94 | # 95 | 96 | # s.resource = "icon.png" 97 | # s.resources = "Resources/*.png" 98 | 99 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 100 | 101 | 102 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 103 | # 104 | # Link your library with frameworks, or libraries. Libraries do not include 105 | # the lib prefix of their name. 106 | # 107 | 108 | # s.framework = "SomeFramework" 109 | # s.frameworks = "SomeFramework", "AnotherFramework" 110 | 111 | # s.library = "iconv" 112 | # s.libraries = "iconv", "xml2" 113 | 114 | 115 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 116 | # 117 | # If your library depends on compiler flags you can set them in the xcconfig hash 118 | # where they will only apply to your library. If you depend on other Podspecs 119 | # you can include multiple dependencies to ensure it works. 120 | 121 | s.requires_arc = true 122 | 123 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 124 | # s.dependency "JSONKit", "~> 1.4" 125 | 126 | end 127 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/TokenView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 19 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Classes/ZFTokenField.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZFTokenField.m 3 | // ZFTokenField 4 | // 5 | // Created by Amornchai Kanokpullwad on 10/11/2014. 6 | // Copyright (c) 2014 Amornchai Kanokpullwad. All rights reserved. 7 | // 8 | 9 | #import "ZFTokenField.h" 10 | 11 | @interface ZFTokenTextField () 12 | - (NSString *)rawText; 13 | @end 14 | 15 | @implementation ZFTokenTextField 16 | 17 | - (void)setText:(NSString *)text 18 | { 19 | if ([text isEqualToString:@""]) { 20 | if (((ZFTokenField *)self.superview).numberOfToken > 0) { 21 | text = @"\u200B"; 22 | } 23 | } 24 | [super setText:text]; 25 | } 26 | 27 | - (NSString *)text 28 | { 29 | return [super.text stringByReplacingOccurrencesOfString:@"\u200B" withString:@""]; 30 | } 31 | 32 | - (NSString *)rawText 33 | { 34 | return super.text; 35 | } 36 | 37 | - (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 38 | { 39 | //Prevent zooming 40 | if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) { 41 | gestureRecognizer.enabled = NO; 42 | } 43 | [super addGestureRecognizer:gestureRecognizer]; 44 | return; 45 | } 46 | 47 | @end 48 | 49 | @interface ZFTokenField () 50 | @property (nonatomic, strong) ZFTokenTextField *textField; 51 | @property (nonatomic, strong) NSMutableArray *tokenViews; 52 | 53 | @property (nonatomic, strong) NSString *tempTextFieldText; 54 | @end 55 | 56 | @implementation ZFTokenField 57 | 58 | - (instancetype)initWithFrame:(CGRect)frame 59 | { 60 | self = [super initWithFrame:frame]; 61 | if (self) { 62 | [self setup]; 63 | } 64 | return self; 65 | } 66 | 67 | - (void)awakeFromNib 68 | { 69 | [super awakeFromNib]; 70 | [self setup]; 71 | } 72 | 73 | - (BOOL)focusOnTextField 74 | { 75 | [self.textField becomeFirstResponder]; 76 | return YES; 77 | } 78 | 79 | #pragma mark - 80 | 81 | - (void)setup 82 | { 83 | self.clipsToBounds = YES; 84 | [self addTarget:self action:@selector(focusOnTextField) forControlEvents:UIControlEventTouchUpInside]; 85 | 86 | self.textField = [[ZFTokenTextField alloc] init]; 87 | self.textField.borderStyle = UITextBorderStyleNone; 88 | self.textField.backgroundColor = [UIColor clearColor]; 89 | self.textField.delegate = self; 90 | [self.textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; 91 | 92 | [self reloadData]; 93 | } 94 | 95 | - (void)layoutSubviews 96 | { 97 | [super layoutSubviews]; 98 | [self invalidateIntrinsicContentSize]; 99 | 100 | NSEnumerator *tokenEnumerator = [self.tokenViews objectEnumerator]; 101 | [self enumerateItemRectsUsingBlock:^(CGRect itemRect) { 102 | UIView *token = [tokenEnumerator nextObject]; 103 | [token setFrame:itemRect]; 104 | }]; 105 | 106 | } 107 | 108 | - (CGSize)intrinsicContentSize 109 | { 110 | if (!self.tokenViews) { 111 | return CGSizeZero; 112 | } 113 | 114 | __block CGRect totalRect = CGRectNull; 115 | [self enumerateItemRectsUsingBlock:^(CGRect itemRect) { 116 | totalRect = CGRectUnion(itemRect, totalRect); 117 | }]; 118 | return totalRect.size; 119 | } 120 | 121 | #pragma mark - Public 122 | 123 | - (void)reloadData 124 | { 125 | // clear 126 | for (UIView *view in self.tokenViews) { 127 | [view removeFromSuperview]; 128 | } 129 | self.tokenViews = [NSMutableArray array]; 130 | 131 | if (self.dataSource) { 132 | NSUInteger count = [self.dataSource numberOfTokenInField:self]; 133 | for (int i = 0 ; i < count ; i++) { 134 | UIView *tokenView = [self.dataSource tokenField:self viewForTokenAtIndex:i]; 135 | tokenView.autoresizingMask = UIViewAutoresizingNone; 136 | [self addSubview:tokenView]; 137 | [self.tokenViews addObject:tokenView]; 138 | } 139 | } 140 | 141 | [self.tokenViews addObject:self.textField]; 142 | [self addSubview:self.textField]; 143 | self.textField.frame = (CGRect) {0,0,50,[self.dataSource lineHeightForTokenInField:self]}; 144 | 145 | [self invalidateIntrinsicContentSize]; 146 | [self.textField setText:@""]; 147 | } 148 | 149 | - (NSUInteger)numberOfToken 150 | { 151 | return self.tokenViews.count - 1; 152 | } 153 | 154 | - (NSUInteger)indexOfTokenView:(UIView *)view 155 | { 156 | return [self.tokenViews indexOfObject:view]; 157 | } 158 | 159 | #pragma mark - Private 160 | 161 | - (void)enumerateItemRectsUsingBlock:(void (^)(CGRect itemRect))block 162 | { 163 | NSUInteger rowCount = 0; 164 | CGFloat x = 0, y = 0; 165 | CGFloat margin = 0; 166 | CGFloat lineHeight = [self.dataSource lineHeightForTokenInField:self]; 167 | 168 | if ([self.delegate respondsToSelector:@selector(tokenMarginInTokenInField:)]) { 169 | margin = [self.delegate tokenMarginInTokenInField:self]; 170 | } 171 | 172 | for (UIView *token in self.tokenViews) { 173 | CGFloat width = MAX(CGRectGetWidth(self.bounds), CGRectGetWidth(token.frame)); 174 | CGFloat tokenWidth = MIN(CGRectGetWidth(self.bounds), CGRectGetWidth(token.frame)); 175 | if (x > width - tokenWidth) { 176 | y += lineHeight + margin; 177 | x = 0; 178 | rowCount = 0; 179 | } 180 | 181 | if ([token isKindOfClass:[ZFTokenTextField class]]) { 182 | UITextField *textField = (UITextField *)token; 183 | CGSize size = [textField sizeThatFits:(CGSize){CGRectGetWidth(self.bounds), lineHeight}]; 184 | size.height = lineHeight; 185 | size.width += 16; // margin right 186 | if (size.width > CGRectGetWidth(self.bounds)) { 187 | size.width = CGRectGetWidth(self.bounds); 188 | } 189 | token.frame = (CGRect){{x, y}, size}; 190 | } 191 | 192 | block((CGRect){x, y, tokenWidth, token.frame.size.height}); 193 | x += tokenWidth + margin; 194 | rowCount++; 195 | } 196 | } 197 | 198 | #pragma mark - TextField 199 | 200 | - (void)textFieldDidBeginEditing:(ZFTokenTextField *)textField 201 | { 202 | self.tempTextFieldText = [textField rawText]; 203 | 204 | if ([self.delegate respondsToSelector:@selector(tokenFieldDidBeginEditing:)]) { 205 | [self.delegate tokenFieldDidBeginEditing:self]; 206 | } 207 | } 208 | 209 | - (BOOL)textFieldShouldEndEditing:(ZFTokenTextField *)textField 210 | { 211 | if ([self.delegate respondsToSelector:@selector(tokenFieldShouldEndEditing:)]) { 212 | return [self.delegate tokenFieldShouldEndEditing:self]; 213 | } 214 | return YES; 215 | } 216 | 217 | - (void)textFieldDidEndEditing:(ZFTokenTextField *)textField 218 | { 219 | if ([self.delegate respondsToSelector:@selector(tokenFieldDidEndEditing:)]) { 220 | [self.delegate tokenFieldDidEndEditing:self]; 221 | } 222 | } 223 | 224 | - (void)textFieldDidChange:(ZFTokenTextField *)textField 225 | { 226 | if ([[textField rawText] isEqualToString:@""]) { 227 | textField.text = @"\u200B"; 228 | 229 | if ([self.tempTextFieldText isEqualToString:@"\u200B"]) { 230 | if (self.tokenViews.count > 1) { 231 | NSUInteger removeIndex = self.tokenViews.count - 2; 232 | [self.tokenViews[removeIndex] removeFromSuperview]; 233 | [self.tokenViews removeObjectAtIndex:removeIndex]; 234 | 235 | [self.textField setText:@""]; 236 | 237 | if ([self.delegate respondsToSelector:@selector(tokenField:didRemoveTokenAtIndex:)]) { 238 | [self.delegate tokenField:self didRemoveTokenAtIndex:removeIndex]; 239 | } 240 | } 241 | } 242 | } 243 | 244 | self.tempTextFieldText = [textField rawText]; 245 | [self invalidateIntrinsicContentSize]; 246 | 247 | if ([self.delegate respondsToSelector:@selector(tokenField:didTextChanged:)]) { 248 | [self.delegate tokenField:self didTextChanged:textField.text]; 249 | } 250 | } 251 | 252 | - (BOOL)textFieldShouldReturn:(UITextField *)textField 253 | { 254 | if ([self.delegate respondsToSelector:@selector(tokenField:didReturnWithText:)]) { 255 | [self.delegate tokenField:self didReturnWithText:textField.text]; 256 | } 257 | return YES; 258 | } 259 | 260 | @end 261 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo/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 | 40 | 41 | 42 | 43 | 44 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /Demo/ZFTokenFieldDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DC233D3B1A1204F70046D2A8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DC233D3A1A1204F70046D2A8 /* main.m */; }; 11 | DC233D3E1A1204F70046D2A8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DC233D3D1A1204F70046D2A8 /* AppDelegate.m */; }; 12 | DC233D411A1204F70046D2A8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DC233D401A1204F70046D2A8 /* ViewController.m */; }; 13 | DC233D441A1204F70046D2A8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC233D421A1204F70046D2A8 /* Main.storyboard */; }; 14 | DC233D461A1204F70046D2A8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC233D451A1204F70046D2A8 /* Images.xcassets */; }; 15 | DC233D491A1204F70046D2A8 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC233D471A1204F70046D2A8 /* LaunchScreen.xib */; }; 16 | DC233D551A1204F70046D2A8 /* ZFTokenFieldDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DC233D541A1204F70046D2A8 /* ZFTokenFieldDemoTests.m */; }; 17 | DC233D611A1205FE0046D2A8 /* ZFTokenField.m in Sources */ = {isa = PBXBuildFile; fileRef = DC233D601A1205FE0046D2A8 /* ZFTokenField.m */; }; 18 | DC233D631A120FD50046D2A8 /* TokenView.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC233D621A120FD50046D2A8 /* TokenView.xib */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | DC233D4F1A1204F70046D2A8 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = DC233D2D1A1204F70046D2A8 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = DC233D341A1204F70046D2A8; 27 | remoteInfo = ZFTokenFieldDemo; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | DC233D351A1204F70046D2A8 /* ZFTokenFieldDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZFTokenFieldDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | DC233D391A1204F70046D2A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | DC233D3A1A1204F70046D2A8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | DC233D3C1A1204F70046D2A8 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | DC233D3D1A1204F70046D2A8 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | DC233D3F1A1204F70046D2A8 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 38 | DC233D401A1204F70046D2A8 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 39 | DC233D431A1204F70046D2A8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | DC233D451A1204F70046D2A8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | DC233D481A1204F70046D2A8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | DC233D4E1A1204F70046D2A8 /* ZFTokenFieldDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZFTokenFieldDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | DC233D531A1204F70046D2A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | DC233D541A1204F70046D2A8 /* ZFTokenFieldDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZFTokenFieldDemoTests.m; sourceTree = ""; }; 45 | DC233D5F1A1205FE0046D2A8 /* ZFTokenField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZFTokenField.h; sourceTree = ""; }; 46 | DC233D601A1205FE0046D2A8 /* ZFTokenField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZFTokenField.m; sourceTree = ""; }; 47 | DC233D621A120FD50046D2A8 /* TokenView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TokenView.xib; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | DC233D321A1204F70046D2A8 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | DC233D4B1A1204F70046D2A8 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | DC233D2C1A1204F70046D2A8 = { 69 | isa = PBXGroup; 70 | children = ( 71 | DC233D371A1204F70046D2A8 /* ZFTokenFieldDemo */, 72 | DC233D511A1204F70046D2A8 /* ZFTokenFieldDemoTests */, 73 | DC233D361A1204F70046D2A8 /* Products */, 74 | ); 75 | sourceTree = ""; 76 | }; 77 | DC233D361A1204F70046D2A8 /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | DC233D351A1204F70046D2A8 /* ZFTokenFieldDemo.app */, 81 | DC233D4E1A1204F70046D2A8 /* ZFTokenFieldDemoTests.xctest */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | DC233D371A1204F70046D2A8 /* ZFTokenFieldDemo */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | DC233D5E1A1205FE0046D2A8 /* Classes */, 90 | DC233D3C1A1204F70046D2A8 /* AppDelegate.h */, 91 | DC233D3D1A1204F70046D2A8 /* AppDelegate.m */, 92 | DC233D3F1A1204F70046D2A8 /* ViewController.h */, 93 | DC233D401A1204F70046D2A8 /* ViewController.m */, 94 | DC233D421A1204F70046D2A8 /* Main.storyboard */, 95 | DC233D451A1204F70046D2A8 /* Images.xcassets */, 96 | DC233D471A1204F70046D2A8 /* LaunchScreen.xib */, 97 | DC233D381A1204F70046D2A8 /* Supporting Files */, 98 | DC233D621A120FD50046D2A8 /* TokenView.xib */, 99 | ); 100 | path = ZFTokenFieldDemo; 101 | sourceTree = ""; 102 | }; 103 | DC233D381A1204F70046D2A8 /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | DC233D391A1204F70046D2A8 /* Info.plist */, 107 | DC233D3A1A1204F70046D2A8 /* main.m */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | DC233D511A1204F70046D2A8 /* ZFTokenFieldDemoTests */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | DC233D541A1204F70046D2A8 /* ZFTokenFieldDemoTests.m */, 116 | DC233D521A1204F70046D2A8 /* Supporting Files */, 117 | ); 118 | path = ZFTokenFieldDemoTests; 119 | sourceTree = ""; 120 | }; 121 | DC233D521A1204F70046D2A8 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | DC233D531A1204F70046D2A8 /* Info.plist */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | DC233D5E1A1205FE0046D2A8 /* Classes */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | DC233D5F1A1205FE0046D2A8 /* ZFTokenField.h */, 133 | DC233D601A1205FE0046D2A8 /* ZFTokenField.m */, 134 | ); 135 | name = Classes; 136 | path = ../../Classes; 137 | sourceTree = ""; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | DC233D341A1204F70046D2A8 /* ZFTokenFieldDemo */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = DC233D581A1204F70046D2A8 /* Build configuration list for PBXNativeTarget "ZFTokenFieldDemo" */; 145 | buildPhases = ( 146 | DC233D311A1204F70046D2A8 /* Sources */, 147 | DC233D321A1204F70046D2A8 /* Frameworks */, 148 | DC233D331A1204F70046D2A8 /* Resources */, 149 | ); 150 | buildRules = ( 151 | ); 152 | dependencies = ( 153 | ); 154 | name = ZFTokenFieldDemo; 155 | productName = ZFTokenFieldDemo; 156 | productReference = DC233D351A1204F70046D2A8 /* ZFTokenFieldDemo.app */; 157 | productType = "com.apple.product-type.application"; 158 | }; 159 | DC233D4D1A1204F70046D2A8 /* ZFTokenFieldDemoTests */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = DC233D5B1A1204F70046D2A8 /* Build configuration list for PBXNativeTarget "ZFTokenFieldDemoTests" */; 162 | buildPhases = ( 163 | DC233D4A1A1204F70046D2A8 /* Sources */, 164 | DC233D4B1A1204F70046D2A8 /* Frameworks */, 165 | DC233D4C1A1204F70046D2A8 /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | DC233D501A1204F70046D2A8 /* PBXTargetDependency */, 171 | ); 172 | name = ZFTokenFieldDemoTests; 173 | productName = ZFTokenFieldDemoTests; 174 | productReference = DC233D4E1A1204F70046D2A8 /* ZFTokenFieldDemoTests.xctest */; 175 | productType = "com.apple.product-type.bundle.unit-test"; 176 | }; 177 | /* End PBXNativeTarget section */ 178 | 179 | /* Begin PBXProject section */ 180 | DC233D2D1A1204F70046D2A8 /* Project object */ = { 181 | isa = PBXProject; 182 | attributes = { 183 | LastUpgradeCheck = 0610; 184 | ORGANIZATIONNAME = "Amornchai Kanokpullwad"; 185 | TargetAttributes = { 186 | DC233D341A1204F70046D2A8 = { 187 | CreatedOnToolsVersion = 6.1; 188 | }; 189 | DC233D4D1A1204F70046D2A8 = { 190 | CreatedOnToolsVersion = 6.1; 191 | TestTargetID = DC233D341A1204F70046D2A8; 192 | }; 193 | }; 194 | }; 195 | buildConfigurationList = DC233D301A1204F70046D2A8 /* Build configuration list for PBXProject "ZFTokenFieldDemo" */; 196 | compatibilityVersion = "Xcode 3.2"; 197 | developmentRegion = English; 198 | hasScannedForEncodings = 0; 199 | knownRegions = ( 200 | en, 201 | Base, 202 | ); 203 | mainGroup = DC233D2C1A1204F70046D2A8; 204 | productRefGroup = DC233D361A1204F70046D2A8 /* Products */; 205 | projectDirPath = ""; 206 | projectRoot = ""; 207 | targets = ( 208 | DC233D341A1204F70046D2A8 /* ZFTokenFieldDemo */, 209 | DC233D4D1A1204F70046D2A8 /* ZFTokenFieldDemoTests */, 210 | ); 211 | }; 212 | /* End PBXProject section */ 213 | 214 | /* Begin PBXResourcesBuildPhase section */ 215 | DC233D331A1204F70046D2A8 /* Resources */ = { 216 | isa = PBXResourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | DC233D441A1204F70046D2A8 /* Main.storyboard in Resources */, 220 | DC233D491A1204F70046D2A8 /* LaunchScreen.xib in Resources */, 221 | DC233D631A120FD50046D2A8 /* TokenView.xib in Resources */, 222 | DC233D461A1204F70046D2A8 /* Images.xcassets in Resources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | DC233D4C1A1204F70046D2A8 /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | DC233D311A1204F70046D2A8 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | DC233D411A1204F70046D2A8 /* ViewController.m in Sources */, 241 | DC233D3E1A1204F70046D2A8 /* AppDelegate.m in Sources */, 242 | DC233D611A1205FE0046D2A8 /* ZFTokenField.m in Sources */, 243 | DC233D3B1A1204F70046D2A8 /* main.m in Sources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | DC233D4A1A1204F70046D2A8 /* Sources */ = { 248 | isa = PBXSourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | DC233D551A1204F70046D2A8 /* ZFTokenFieldDemoTests.m in Sources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXSourcesBuildPhase section */ 256 | 257 | /* Begin PBXTargetDependency section */ 258 | DC233D501A1204F70046D2A8 /* PBXTargetDependency */ = { 259 | isa = PBXTargetDependency; 260 | target = DC233D341A1204F70046D2A8 /* ZFTokenFieldDemo */; 261 | targetProxy = DC233D4F1A1204F70046D2A8 /* PBXContainerItemProxy */; 262 | }; 263 | /* End PBXTargetDependency section */ 264 | 265 | /* Begin PBXVariantGroup section */ 266 | DC233D421A1204F70046D2A8 /* Main.storyboard */ = { 267 | isa = PBXVariantGroup; 268 | children = ( 269 | DC233D431A1204F70046D2A8 /* Base */, 270 | ); 271 | name = Main.storyboard; 272 | sourceTree = ""; 273 | }; 274 | DC233D471A1204F70046D2A8 /* LaunchScreen.xib */ = { 275 | isa = PBXVariantGroup; 276 | children = ( 277 | DC233D481A1204F70046D2A8 /* Base */, 278 | ); 279 | name = LaunchScreen.xib; 280 | sourceTree = ""; 281 | }; 282 | /* End PBXVariantGroup section */ 283 | 284 | /* Begin XCBuildConfiguration section */ 285 | DC233D561A1204F70046D2A8 /* Debug */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ALWAYS_SEARCH_USER_PATHS = NO; 289 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 290 | CLANG_CXX_LIBRARY = "libc++"; 291 | CLANG_ENABLE_MODULES = YES; 292 | CLANG_ENABLE_OBJC_ARC = YES; 293 | CLANG_WARN_BOOL_CONVERSION = YES; 294 | CLANG_WARN_CONSTANT_CONVERSION = YES; 295 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 296 | CLANG_WARN_EMPTY_BODY = YES; 297 | CLANG_WARN_ENUM_CONVERSION = YES; 298 | CLANG_WARN_INT_CONVERSION = YES; 299 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 300 | CLANG_WARN_UNREACHABLE_CODE = YES; 301 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 302 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 303 | COPY_PHASE_STRIP = NO; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | GCC_C_LANGUAGE_STANDARD = gnu99; 306 | GCC_DYNAMIC_NO_PIC = NO; 307 | GCC_OPTIMIZATION_LEVEL = 0; 308 | GCC_PREPROCESSOR_DEFINITIONS = ( 309 | "DEBUG=1", 310 | "$(inherited)", 311 | ); 312 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 313 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 314 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 315 | GCC_WARN_UNDECLARED_SELECTOR = YES; 316 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 317 | GCC_WARN_UNUSED_FUNCTION = YES; 318 | GCC_WARN_UNUSED_VARIABLE = YES; 319 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 320 | MTL_ENABLE_DEBUG_INFO = YES; 321 | ONLY_ACTIVE_ARCH = YES; 322 | SDKROOT = iphoneos; 323 | }; 324 | name = Debug; 325 | }; 326 | DC233D571A1204F70046D2A8 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_CONSTANT_CONVERSION = YES; 336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | COPY_PHASE_STRIP = YES; 345 | ENABLE_NS_ASSERTIONS = NO; 346 | ENABLE_STRICT_OBJC_MSGSEND = YES; 347 | GCC_C_LANGUAGE_STANDARD = gnu99; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | VALIDATE_PRODUCT = YES; 358 | }; 359 | name = Release; 360 | }; 361 | DC233D591A1204F70046D2A8 /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | INFOPLIST_FILE = ZFTokenFieldDemo/Info.plist; 366 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | }; 370 | name = Debug; 371 | }; 372 | DC233D5A1A1204F70046D2A8 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | INFOPLIST_FILE = ZFTokenFieldDemo/Info.plist; 377 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | }; 381 | name = Release; 382 | }; 383 | DC233D5C1A1204F70046D2A8 /* Debug */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | BUNDLE_LOADER = "$(TEST_HOST)"; 387 | FRAMEWORK_SEARCH_PATHS = ( 388 | "$(SDKROOT)/Developer/Library/Frameworks", 389 | "$(inherited)", 390 | ); 391 | GCC_PREPROCESSOR_DEFINITIONS = ( 392 | "DEBUG=1", 393 | "$(inherited)", 394 | ); 395 | INFOPLIST_FILE = ZFTokenFieldDemoTests/Info.plist; 396 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZFTokenFieldDemo.app/ZFTokenFieldDemo"; 399 | }; 400 | name = Debug; 401 | }; 402 | DC233D5D1A1204F70046D2A8 /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | BUNDLE_LOADER = "$(TEST_HOST)"; 406 | FRAMEWORK_SEARCH_PATHS = ( 407 | "$(SDKROOT)/Developer/Library/Frameworks", 408 | "$(inherited)", 409 | ); 410 | INFOPLIST_FILE = ZFTokenFieldDemoTests/Info.plist; 411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZFTokenFieldDemo.app/ZFTokenFieldDemo"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | DC233D301A1204F70046D2A8 /* Build configuration list for PBXProject "ZFTokenFieldDemo" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | DC233D561A1204F70046D2A8 /* Debug */, 424 | DC233D571A1204F70046D2A8 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | DC233D581A1204F70046D2A8 /* Build configuration list for PBXNativeTarget "ZFTokenFieldDemo" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | DC233D591A1204F70046D2A8 /* Debug */, 433 | DC233D5A1A1204F70046D2A8 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | DC233D5B1A1204F70046D2A8 /* Build configuration list for PBXNativeTarget "ZFTokenFieldDemoTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | DC233D5C1A1204F70046D2A8 /* Debug */, 442 | DC233D5D1A1204F70046D2A8 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = DC233D2D1A1204F70046D2A8 /* Project object */; 450 | } 451 | --------------------------------------------------------------------------------