├── .gitignore ├── AKTagsInputView.podspec ├── AKTagsInputViewExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── AKTagsInputViewExample.xccheckout │ └── xcuserdata │ │ └── andreykadochnikov.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── andreykadochnikov.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── AKTagsInputViewExample.xcscheme │ └── xcschememanagement.plist ├── AKTagsInputViewExample ├── AKAppDelegate.h ├── AKAppDelegate.m ├── AKTagsInputViewExample-Info.plist ├── AKTagsInputViewExample-Prefix.pch ├── AKViewController.h ├── AKViewController.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── en.lproj │ └── InfoPlist.strings └── main.m ├── AKTagsInputViewExampleTests ├── AKTagsInputViewExampleTests-Info.plist ├── AKTagsInputViewExampleTests.m └── en.lproj │ └── InfoPlist.strings ├── Classes ├── AKTagCell.h ├── AKTagCell.m ├── AKTagTextFieldCell.h ├── AKTagTextFieldCell.m ├── AKTagsDefines.h ├── AKTagsInputView.h ├── AKTagsInputView.m ├── AKTagsListView.h ├── AKTagsListView.m ├── AKTagsLookup.h ├── AKTagsLookup.m ├── AKTextField.h ├── AKTextField.m ├── Constants.h ├── NSString+StringSizeWithFont.h └── NSString+StringSizeWithFont.m ├── LICENSE ├── README.md └── Resources ├── cross_icon.png ├── cross_icon@2x.png ├── cross_red_icon.png └── cross_red_icon@2x.png /.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | # 3 | # We recommend against adding the Pods directory to your .gitignore. However 4 | # you should judge for yourself, the pros and cons are mentioned at: 5 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control? 6 | # 7 | # Pods/ 8 | 9 | # Xcode 10 | .DS_Store 11 | */build/* 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | profile 22 | *.moved-aside 23 | DerivedData 24 | .idea/ 25 | *.hmap 26 | *.xccheckout -------------------------------------------------------------------------------- /AKTagsInputView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AKTagsInputView" 3 | s.version = "1.0.0" 4 | s.summary = "convenient input view for tags strings" 5 | s.description = "AKTagsInputView class implements a convenient input view for seek'n'selecting and writing tags data." 6 | s.homepage = "https://github.com/purrrminator/AKTagsInputView" 7 | s.screenshots = "http://cdn.makeagif.com/media/6-01-2014/anzpi7.gif" 8 | s.license = { :type => "MIT", :file => "LICENSE" } 9 | s.author = { "Andrey Kadochnikov" => "kaskaaddnb@gmail.com" } 10 | s.social_media_url = "http://twitter.com/purrrminator" 11 | s.platform = :ios, "7.0" 12 | s.source = { :git => "https://github.com/purrrminator/AKTagsInputView.git", :tag => s.version.to_s } 13 | s.source_files = "Classes", "Classes/*.{h,m}" 14 | s.public_header_files = "Classes/*.h" 15 | s.resources = "Resources/*.png" 16 | s.requires_arc = true 17 | end 18 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B9676C141977004C00AFCE83 /* AKTagCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C061977004C00AFCE83 /* AKTagCell.m */; }; 11 | B9676C151977004C00AFCE83 /* AKTagsInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C091977004C00AFCE83 /* AKTagsInputView.m */; }; 12 | B9676C161977004C00AFCE83 /* AKTagsListView.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C0B1977004C00AFCE83 /* AKTagsListView.m */; }; 13 | B9676C171977004C00AFCE83 /* AKTagsLookup.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C0D1977004C00AFCE83 /* AKTagsLookup.m */; }; 14 | B9676C181977004C00AFCE83 /* AKTagTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C0F1977004C00AFCE83 /* AKTagTextFieldCell.m */; }; 15 | B9676C191977004C00AFCE83 /* AKTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C111977004C00AFCE83 /* AKTextField.m */; }; 16 | B9676C1A1977004C00AFCE83 /* NSString+StringSizeWithFont.m in Sources */ = {isa = PBXBuildFile; fileRef = B9676C131977004C00AFCE83 /* NSString+StringSizeWithFont.m */; }; 17 | B9EC363A193B797C0007C5FF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EC3639193B797C0007C5FF /* Foundation.framework */; }; 18 | B9EC363C193B797C0007C5FF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EC363B193B797C0007C5FF /* CoreGraphics.framework */; }; 19 | B9EC363E193B797C0007C5FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EC363D193B797C0007C5FF /* UIKit.framework */; }; 20 | B9EC3644193B797C0007C5FF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3642193B797C0007C5FF /* InfoPlist.strings */; }; 21 | B9EC3646193B797C0007C5FF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B9EC3645193B797C0007C5FF /* main.m */; }; 22 | B9EC364A193B797C0007C5FF /* AKAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B9EC3649193B797C0007C5FF /* AKAppDelegate.m */; }; 23 | B9EC3650193B797C0007C5FF /* AKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9EC364F193B797C0007C5FF /* AKViewController.m */; }; 24 | B9EC3652193B797C0007C5FF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3651193B797C0007C5FF /* Images.xcassets */; }; 25 | B9EC3659193B797C0007C5FF /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EC3658193B797C0007C5FF /* XCTest.framework */; }; 26 | B9EC365A193B797C0007C5FF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EC3639193B797C0007C5FF /* Foundation.framework */; }; 27 | B9EC365B193B797C0007C5FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EC363D193B797C0007C5FF /* UIKit.framework */; }; 28 | B9EC3663193B797C0007C5FF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3661193B797C0007C5FF /* InfoPlist.strings */; }; 29 | B9EC3665193B797C0007C5FF /* AKTagsInputViewExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B9EC3664193B797C0007C5FF /* AKTagsInputViewExampleTests.m */; }; 30 | B9EC3684193B7A9D0007C5FF /* cross_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3682193B7A9D0007C5FF /* cross_icon.png */; }; 31 | B9EC3685193B7A9D0007C5FF /* cross_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3683193B7A9D0007C5FF /* cross_icon@2x.png */; }; 32 | B9EC3688193B7AA70007C5FF /* cross_red_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3686193B7AA70007C5FF /* cross_red_icon.png */; }; 33 | B9EC3689193B7AA70007C5FF /* cross_red_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B9EC3687193B7AA70007C5FF /* cross_red_icon@2x.png */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXContainerItemProxy section */ 37 | B9EC365C193B797C0007C5FF /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = B9EC362E193B797C0007C5FF /* Project object */; 40 | proxyType = 1; 41 | remoteGlobalIDString = B9EC3635193B797C0007C5FF; 42 | remoteInfo = AKTagsInputViewExample; 43 | }; 44 | /* End PBXContainerItemProxy section */ 45 | 46 | /* Begin PBXFileReference section */ 47 | 502817EF1A99EF8600304109 /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = ""; }; 48 | B9676C051977004C00AFCE83 /* AKTagCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTagCell.h; sourceTree = ""; }; 49 | B9676C061977004C00AFCE83 /* AKTagCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AKTagCell.m; sourceTree = ""; }; 50 | B9676C071977004C00AFCE83 /* AKTagsDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTagsDefines.h; sourceTree = ""; }; 51 | B9676C081977004C00AFCE83 /* AKTagsInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTagsInputView.h; sourceTree = ""; }; 52 | B9676C091977004C00AFCE83 /* AKTagsInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AKTagsInputView.m; sourceTree = ""; }; 53 | B9676C0A1977004C00AFCE83 /* AKTagsListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTagsListView.h; sourceTree = ""; }; 54 | B9676C0B1977004C00AFCE83 /* AKTagsListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AKTagsListView.m; sourceTree = ""; }; 55 | B9676C0C1977004C00AFCE83 /* AKTagsLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTagsLookup.h; sourceTree = ""; }; 56 | B9676C0D1977004C00AFCE83 /* AKTagsLookup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AKTagsLookup.m; sourceTree = ""; }; 57 | B9676C0E1977004C00AFCE83 /* AKTagTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTagTextFieldCell.h; sourceTree = ""; }; 58 | B9676C0F1977004C00AFCE83 /* AKTagTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AKTagTextFieldCell.m; sourceTree = ""; }; 59 | B9676C101977004C00AFCE83 /* AKTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AKTextField.h; sourceTree = ""; }; 60 | B9676C111977004C00AFCE83 /* AKTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AKTextField.m; sourceTree = ""; }; 61 | B9676C121977004C00AFCE83 /* NSString+StringSizeWithFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+StringSizeWithFont.h"; sourceTree = ""; }; 62 | B9676C131977004C00AFCE83 /* NSString+StringSizeWithFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+StringSizeWithFont.m"; sourceTree = ""; }; 63 | B9EC3636193B797C0007C5FF /* AKTagsInputViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AKTagsInputViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | B9EC3639193B797C0007C5FF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 65 | B9EC363B193B797C0007C5FF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 66 | B9EC363D193B797C0007C5FF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 67 | B9EC3641193B797C0007C5FF /* AKTagsInputViewExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AKTagsInputViewExample-Info.plist"; sourceTree = ""; }; 68 | B9EC3643193B797C0007C5FF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 69 | B9EC3645193B797C0007C5FF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 70 | B9EC3647193B797C0007C5FF /* AKTagsInputViewExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AKTagsInputViewExample-Prefix.pch"; sourceTree = ""; }; 71 | B9EC3648193B797C0007C5FF /* AKAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AKAppDelegate.h; sourceTree = ""; }; 72 | B9EC3649193B797C0007C5FF /* AKAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AKAppDelegate.m; sourceTree = ""; }; 73 | B9EC364E193B797C0007C5FF /* AKViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AKViewController.h; sourceTree = ""; }; 74 | B9EC364F193B797C0007C5FF /* AKViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AKViewController.m; sourceTree = ""; }; 75 | B9EC3651193B797C0007C5FF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 76 | B9EC3657193B797C0007C5FF /* AKTagsInputViewExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AKTagsInputViewExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 77 | B9EC3658193B797C0007C5FF /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 78 | B9EC3660193B797C0007C5FF /* AKTagsInputViewExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AKTagsInputViewExampleTests-Info.plist"; sourceTree = ""; }; 79 | B9EC3662193B797C0007C5FF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 80 | B9EC3664193B797C0007C5FF /* AKTagsInputViewExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AKTagsInputViewExampleTests.m; sourceTree = ""; }; 81 | B9EC3682193B7A9D0007C5FF /* cross_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cross_icon.png; sourceTree = ""; }; 82 | B9EC3683193B7A9D0007C5FF /* cross_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cross_icon@2x.png"; sourceTree = ""; }; 83 | B9EC3686193B7AA70007C5FF /* cross_red_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cross_red_icon.png; sourceTree = ""; }; 84 | B9EC3687193B7AA70007C5FF /* cross_red_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cross_red_icon@2x.png"; sourceTree = ""; }; 85 | /* End PBXFileReference section */ 86 | 87 | /* Begin PBXFrameworksBuildPhase section */ 88 | B9EC3633193B797C0007C5FF /* Frameworks */ = { 89 | isa = PBXFrameworksBuildPhase; 90 | buildActionMask = 2147483647; 91 | files = ( 92 | B9EC363C193B797C0007C5FF /* CoreGraphics.framework in Frameworks */, 93 | B9EC363E193B797C0007C5FF /* UIKit.framework in Frameworks */, 94 | B9EC363A193B797C0007C5FF /* Foundation.framework in Frameworks */, 95 | ); 96 | runOnlyForDeploymentPostprocessing = 0; 97 | }; 98 | B9EC3654193B797C0007C5FF /* Frameworks */ = { 99 | isa = PBXFrameworksBuildPhase; 100 | buildActionMask = 2147483647; 101 | files = ( 102 | B9EC3659193B797C0007C5FF /* XCTest.framework in Frameworks */, 103 | B9EC365B193B797C0007C5FF /* UIKit.framework in Frameworks */, 104 | B9EC365A193B797C0007C5FF /* Foundation.framework in Frameworks */, 105 | ); 106 | runOnlyForDeploymentPostprocessing = 0; 107 | }; 108 | /* End PBXFrameworksBuildPhase section */ 109 | 110 | /* Begin PBXGroup section */ 111 | B9EC362D193B797C0007C5FF = { 112 | isa = PBXGroup; 113 | children = ( 114 | B9EC363F193B797C0007C5FF /* AKTagsInputViewExample */, 115 | B9EC365E193B797C0007C5FF /* AKTagsInputViewExampleTests */, 116 | B9EC3638193B797C0007C5FF /* Frameworks */, 117 | B9EC3637193B797C0007C5FF /* Products */, 118 | ); 119 | sourceTree = ""; 120 | }; 121 | B9EC3637193B797C0007C5FF /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | B9EC3636193B797C0007C5FF /* AKTagsInputViewExample.app */, 125 | B9EC3657193B797C0007C5FF /* AKTagsInputViewExampleTests.xctest */, 126 | ); 127 | name = Products; 128 | sourceTree = ""; 129 | }; 130 | B9EC3638193B797C0007C5FF /* Frameworks */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | B9EC3639193B797C0007C5FF /* Foundation.framework */, 134 | B9EC363B193B797C0007C5FF /* CoreGraphics.framework */, 135 | B9EC363D193B797C0007C5FF /* UIKit.framework */, 136 | B9EC3658193B797C0007C5FF /* XCTest.framework */, 137 | ); 138 | name = Frameworks; 139 | sourceTree = ""; 140 | }; 141 | B9EC363F193B797C0007C5FF /* AKTagsInputViewExample */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | B9EC366E193B79BF0007C5FF /* AKTagsInputView */, 145 | B9EC3648193B797C0007C5FF /* AKAppDelegate.h */, 146 | B9EC3649193B797C0007C5FF /* AKAppDelegate.m */, 147 | B9EC364E193B797C0007C5FF /* AKViewController.h */, 148 | B9EC364F193B797C0007C5FF /* AKViewController.m */, 149 | B9EC3651193B797C0007C5FF /* Images.xcassets */, 150 | B9EC3640193B797C0007C5FF /* Supporting Files */, 151 | ); 152 | path = AKTagsInputViewExample; 153 | sourceTree = ""; 154 | }; 155 | B9EC3640193B797C0007C5FF /* Supporting Files */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | B9EC3641193B797C0007C5FF /* AKTagsInputViewExample-Info.plist */, 159 | B9EC3642193B797C0007C5FF /* InfoPlist.strings */, 160 | B9EC3645193B797C0007C5FF /* main.m */, 161 | B9EC3647193B797C0007C5FF /* AKTagsInputViewExample-Prefix.pch */, 162 | ); 163 | name = "Supporting Files"; 164 | sourceTree = ""; 165 | }; 166 | B9EC365E193B797C0007C5FF /* AKTagsInputViewExampleTests */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | B9EC3664193B797C0007C5FF /* AKTagsInputViewExampleTests.m */, 170 | B9EC365F193B797C0007C5FF /* Supporting Files */, 171 | ); 172 | path = AKTagsInputViewExampleTests; 173 | sourceTree = ""; 174 | }; 175 | B9EC365F193B797C0007C5FF /* Supporting Files */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | B9EC3660193B797C0007C5FF /* AKTagsInputViewExampleTests-Info.plist */, 179 | B9EC3661193B797C0007C5FF /* InfoPlist.strings */, 180 | ); 181 | name = "Supporting Files"; 182 | sourceTree = ""; 183 | }; 184 | B9EC366E193B79BF0007C5FF /* AKTagsInputView */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | B9676C051977004C00AFCE83 /* AKTagCell.h */, 188 | B9676C061977004C00AFCE83 /* AKTagCell.m */, 189 | B9676C071977004C00AFCE83 /* AKTagsDefines.h */, 190 | B9676C081977004C00AFCE83 /* AKTagsInputView.h */, 191 | B9676C091977004C00AFCE83 /* AKTagsInputView.m */, 192 | B9676C0A1977004C00AFCE83 /* AKTagsListView.h */, 193 | B9676C0B1977004C00AFCE83 /* AKTagsListView.m */, 194 | B9676C0C1977004C00AFCE83 /* AKTagsLookup.h */, 195 | B9676C0D1977004C00AFCE83 /* AKTagsLookup.m */, 196 | B9676C0E1977004C00AFCE83 /* AKTagTextFieldCell.h */, 197 | B9676C0F1977004C00AFCE83 /* AKTagTextFieldCell.m */, 198 | B9676C101977004C00AFCE83 /* AKTextField.h */, 199 | B9676C111977004C00AFCE83 /* AKTextField.m */, 200 | B9676C121977004C00AFCE83 /* NSString+StringSizeWithFont.h */, 201 | B9676C131977004C00AFCE83 /* NSString+StringSizeWithFont.m */, 202 | B9EC3681193B7A5A0007C5FF /* Resources */, 203 | 502817EF1A99EF8600304109 /* Constants.h */, 204 | ); 205 | name = AKTagsInputView; 206 | path = ../Classes; 207 | sourceTree = ""; 208 | }; 209 | B9EC3681193B7A5A0007C5FF /* Resources */ = { 210 | isa = PBXGroup; 211 | children = ( 212 | B9EC3686193B7AA70007C5FF /* cross_red_icon.png */, 213 | B9EC3687193B7AA70007C5FF /* cross_red_icon@2x.png */, 214 | B9EC3682193B7A9D0007C5FF /* cross_icon.png */, 215 | B9EC3683193B7A9D0007C5FF /* cross_icon@2x.png */, 216 | ); 217 | name = Resources; 218 | path = ../Resources; 219 | sourceTree = ""; 220 | }; 221 | /* End PBXGroup section */ 222 | 223 | /* Begin PBXNativeTarget section */ 224 | B9EC3635193B797C0007C5FF /* AKTagsInputViewExample */ = { 225 | isa = PBXNativeTarget; 226 | buildConfigurationList = B9EC3668193B797C0007C5FF /* Build configuration list for PBXNativeTarget "AKTagsInputViewExample" */; 227 | buildPhases = ( 228 | B9EC3632193B797C0007C5FF /* Sources */, 229 | B9EC3633193B797C0007C5FF /* Frameworks */, 230 | B9EC3634193B797C0007C5FF /* Resources */, 231 | ); 232 | buildRules = ( 233 | ); 234 | dependencies = ( 235 | ); 236 | name = AKTagsInputViewExample; 237 | productName = AKTagsInputViewExample; 238 | productReference = B9EC3636193B797C0007C5FF /* AKTagsInputViewExample.app */; 239 | productType = "com.apple.product-type.application"; 240 | }; 241 | B9EC3656193B797C0007C5FF /* AKTagsInputViewExampleTests */ = { 242 | isa = PBXNativeTarget; 243 | buildConfigurationList = B9EC366B193B797C0007C5FF /* Build configuration list for PBXNativeTarget "AKTagsInputViewExampleTests" */; 244 | buildPhases = ( 245 | B9EC3653193B797C0007C5FF /* Sources */, 246 | B9EC3654193B797C0007C5FF /* Frameworks */, 247 | B9EC3655193B797C0007C5FF /* Resources */, 248 | ); 249 | buildRules = ( 250 | ); 251 | dependencies = ( 252 | B9EC365D193B797C0007C5FF /* PBXTargetDependency */, 253 | ); 254 | name = AKTagsInputViewExampleTests; 255 | productName = AKTagsInputViewExampleTests; 256 | productReference = B9EC3657193B797C0007C5FF /* AKTagsInputViewExampleTests.xctest */; 257 | productType = "com.apple.product-type.bundle.unit-test"; 258 | }; 259 | /* End PBXNativeTarget section */ 260 | 261 | /* Begin PBXProject section */ 262 | B9EC362E193B797C0007C5FF /* Project object */ = { 263 | isa = PBXProject; 264 | attributes = { 265 | CLASSPREFIX = AK; 266 | LastUpgradeCheck = 0510; 267 | ORGANIZATIONNAME = "Andrey Kadochnikov"; 268 | TargetAttributes = { 269 | B9EC3656193B797C0007C5FF = { 270 | TestTargetID = B9EC3635193B797C0007C5FF; 271 | }; 272 | }; 273 | }; 274 | buildConfigurationList = B9EC3631193B797C0007C5FF /* Build configuration list for PBXProject "AKTagsInputViewExample" */; 275 | compatibilityVersion = "Xcode 3.2"; 276 | developmentRegion = English; 277 | hasScannedForEncodings = 0; 278 | knownRegions = ( 279 | en, 280 | Base, 281 | ); 282 | mainGroup = B9EC362D193B797C0007C5FF; 283 | productRefGroup = B9EC3637193B797C0007C5FF /* Products */; 284 | projectDirPath = ""; 285 | projectRoot = ""; 286 | targets = ( 287 | B9EC3635193B797C0007C5FF /* AKTagsInputViewExample */, 288 | B9EC3656193B797C0007C5FF /* AKTagsInputViewExampleTests */, 289 | ); 290 | }; 291 | /* End PBXProject section */ 292 | 293 | /* Begin PBXResourcesBuildPhase section */ 294 | B9EC3634193B797C0007C5FF /* Resources */ = { 295 | isa = PBXResourcesBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | B9EC3685193B7A9D0007C5FF /* cross_icon@2x.png in Resources */, 299 | B9EC3688193B7AA70007C5FF /* cross_red_icon.png in Resources */, 300 | B9EC3652193B797C0007C5FF /* Images.xcassets in Resources */, 301 | B9EC3684193B7A9D0007C5FF /* cross_icon.png in Resources */, 302 | B9EC3689193B7AA70007C5FF /* cross_red_icon@2x.png in Resources */, 303 | B9EC3644193B797C0007C5FF /* InfoPlist.strings in Resources */, 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | B9EC3655193B797C0007C5FF /* Resources */ = { 308 | isa = PBXResourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | B9EC3663193B797C0007C5FF /* InfoPlist.strings in Resources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | /* End PBXResourcesBuildPhase section */ 316 | 317 | /* Begin PBXSourcesBuildPhase section */ 318 | B9EC3632193B797C0007C5FF /* Sources */ = { 319 | isa = PBXSourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | B9676C181977004C00AFCE83 /* AKTagTextFieldCell.m in Sources */, 323 | B9EC364A193B797C0007C5FF /* AKAppDelegate.m in Sources */, 324 | B9676C161977004C00AFCE83 /* AKTagsListView.m in Sources */, 325 | B9676C151977004C00AFCE83 /* AKTagsInputView.m in Sources */, 326 | B9676C191977004C00AFCE83 /* AKTextField.m in Sources */, 327 | B9EC3650193B797C0007C5FF /* AKViewController.m in Sources */, 328 | B9676C1A1977004C00AFCE83 /* NSString+StringSizeWithFont.m in Sources */, 329 | B9676C141977004C00AFCE83 /* AKTagCell.m in Sources */, 330 | B9EC3646193B797C0007C5FF /* main.m in Sources */, 331 | B9676C171977004C00AFCE83 /* AKTagsLookup.m in Sources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | B9EC3653193B797C0007C5FF /* Sources */ = { 336 | isa = PBXSourcesBuildPhase; 337 | buildActionMask = 2147483647; 338 | files = ( 339 | B9EC3665193B797C0007C5FF /* AKTagsInputViewExampleTests.m in Sources */, 340 | ); 341 | runOnlyForDeploymentPostprocessing = 0; 342 | }; 343 | /* End PBXSourcesBuildPhase section */ 344 | 345 | /* Begin PBXTargetDependency section */ 346 | B9EC365D193B797C0007C5FF /* PBXTargetDependency */ = { 347 | isa = PBXTargetDependency; 348 | target = B9EC3635193B797C0007C5FF /* AKTagsInputViewExample */; 349 | targetProxy = B9EC365C193B797C0007C5FF /* PBXContainerItemProxy */; 350 | }; 351 | /* End PBXTargetDependency section */ 352 | 353 | /* Begin PBXVariantGroup section */ 354 | B9EC3642193B797C0007C5FF /* InfoPlist.strings */ = { 355 | isa = PBXVariantGroup; 356 | children = ( 357 | B9EC3643193B797C0007C5FF /* en */, 358 | ); 359 | name = InfoPlist.strings; 360 | sourceTree = ""; 361 | }; 362 | B9EC3661193B797C0007C5FF /* InfoPlist.strings */ = { 363 | isa = PBXVariantGroup; 364 | children = ( 365 | B9EC3662193B797C0007C5FF /* en */, 366 | ); 367 | name = InfoPlist.strings; 368 | sourceTree = ""; 369 | }; 370 | /* End PBXVariantGroup section */ 371 | 372 | /* Begin XCBuildConfiguration section */ 373 | B9EC3666193B797C0007C5FF /* Debug */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ALWAYS_SEARCH_USER_PATHS = NO; 377 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 378 | CLANG_CXX_LIBRARY = "libc++"; 379 | CLANG_ENABLE_MODULES = YES; 380 | CLANG_ENABLE_OBJC_ARC = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 384 | CLANG_WARN_EMPTY_BODY = YES; 385 | CLANG_WARN_ENUM_CONVERSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 389 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 390 | COPY_PHASE_STRIP = NO; 391 | GCC_C_LANGUAGE_STANDARD = gnu99; 392 | GCC_DYNAMIC_NO_PIC = NO; 393 | GCC_OPTIMIZATION_LEVEL = 0; 394 | GCC_PREPROCESSOR_DEFINITIONS = ( 395 | "DEBUG=1", 396 | "$(inherited)", 397 | ); 398 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 399 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 400 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 401 | GCC_WARN_UNDECLARED_SELECTOR = YES; 402 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 403 | GCC_WARN_UNUSED_FUNCTION = YES; 404 | GCC_WARN_UNUSED_VARIABLE = YES; 405 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 406 | ONLY_ACTIVE_ARCH = YES; 407 | SDKROOT = iphoneos; 408 | }; 409 | name = Debug; 410 | }; 411 | B9EC3667193B797C0007C5FF /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ALWAYS_SEARCH_USER_PATHS = NO; 415 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 416 | CLANG_CXX_LIBRARY = "libc++"; 417 | CLANG_ENABLE_MODULES = YES; 418 | CLANG_ENABLE_OBJC_ARC = YES; 419 | CLANG_WARN_BOOL_CONVERSION = YES; 420 | CLANG_WARN_CONSTANT_CONVERSION = YES; 421 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 422 | CLANG_WARN_EMPTY_BODY = YES; 423 | CLANG_WARN_ENUM_CONVERSION = YES; 424 | CLANG_WARN_INT_CONVERSION = YES; 425 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 426 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 427 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 428 | COPY_PHASE_STRIP = YES; 429 | ENABLE_NS_ASSERTIONS = NO; 430 | GCC_C_LANGUAGE_STANDARD = gnu99; 431 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 432 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 433 | GCC_WARN_UNDECLARED_SELECTOR = YES; 434 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 435 | GCC_WARN_UNUSED_FUNCTION = YES; 436 | GCC_WARN_UNUSED_VARIABLE = YES; 437 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 438 | SDKROOT = iphoneos; 439 | VALIDATE_PRODUCT = YES; 440 | }; 441 | name = Release; 442 | }; 443 | B9EC3669193B797C0007C5FF /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 447 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 448 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 449 | GCC_PREFIX_HEADER = "AKTagsInputViewExample/AKTagsInputViewExample-Prefix.pch"; 450 | INFOPLIST_FILE = "AKTagsInputViewExample/AKTagsInputViewExample-Info.plist"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | WRAPPER_EXTENSION = app; 453 | }; 454 | name = Debug; 455 | }; 456 | B9EC366A193B797C0007C5FF /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 460 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 461 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 462 | GCC_PREFIX_HEADER = "AKTagsInputViewExample/AKTagsInputViewExample-Prefix.pch"; 463 | INFOPLIST_FILE = "AKTagsInputViewExample/AKTagsInputViewExample-Info.plist"; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | WRAPPER_EXTENSION = app; 466 | }; 467 | name = Release; 468 | }; 469 | B9EC366C193B797C0007C5FF /* Debug */ = { 470 | isa = XCBuildConfiguration; 471 | buildSettings = { 472 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AKTagsInputViewExample.app/AKTagsInputViewExample"; 473 | FRAMEWORK_SEARCH_PATHS = ( 474 | "$(SDKROOT)/Developer/Library/Frameworks", 475 | "$(inherited)", 476 | "$(DEVELOPER_FRAMEWORKS_DIR)", 477 | ); 478 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 479 | GCC_PREFIX_HEADER = "AKTagsInputViewExample/AKTagsInputViewExample-Prefix.pch"; 480 | GCC_PREPROCESSOR_DEFINITIONS = ( 481 | "DEBUG=1", 482 | "$(inherited)", 483 | ); 484 | INFOPLIST_FILE = "AKTagsInputViewExampleTests/AKTagsInputViewExampleTests-Info.plist"; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_HOST = "$(BUNDLE_LOADER)"; 487 | WRAPPER_EXTENSION = xctest; 488 | }; 489 | name = Debug; 490 | }; 491 | B9EC366D193B797C0007C5FF /* Release */ = { 492 | isa = XCBuildConfiguration; 493 | buildSettings = { 494 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AKTagsInputViewExample.app/AKTagsInputViewExample"; 495 | FRAMEWORK_SEARCH_PATHS = ( 496 | "$(SDKROOT)/Developer/Library/Frameworks", 497 | "$(inherited)", 498 | "$(DEVELOPER_FRAMEWORKS_DIR)", 499 | ); 500 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 501 | GCC_PREFIX_HEADER = "AKTagsInputViewExample/AKTagsInputViewExample-Prefix.pch"; 502 | INFOPLIST_FILE = "AKTagsInputViewExampleTests/AKTagsInputViewExampleTests-Info.plist"; 503 | PRODUCT_NAME = "$(TARGET_NAME)"; 504 | TEST_HOST = "$(BUNDLE_LOADER)"; 505 | WRAPPER_EXTENSION = xctest; 506 | }; 507 | name = Release; 508 | }; 509 | /* End XCBuildConfiguration section */ 510 | 511 | /* Begin XCConfigurationList section */ 512 | B9EC3631193B797C0007C5FF /* Build configuration list for PBXProject "AKTagsInputViewExample" */ = { 513 | isa = XCConfigurationList; 514 | buildConfigurations = ( 515 | B9EC3666193B797C0007C5FF /* Debug */, 516 | B9EC3667193B797C0007C5FF /* Release */, 517 | ); 518 | defaultConfigurationIsVisible = 0; 519 | defaultConfigurationName = Release; 520 | }; 521 | B9EC3668193B797C0007C5FF /* Build configuration list for PBXNativeTarget "AKTagsInputViewExample" */ = { 522 | isa = XCConfigurationList; 523 | buildConfigurations = ( 524 | B9EC3669193B797C0007C5FF /* Debug */, 525 | B9EC366A193B797C0007C5FF /* Release */, 526 | ); 527 | defaultConfigurationIsVisible = 0; 528 | defaultConfigurationName = Release; 529 | }; 530 | B9EC366B193B797C0007C5FF /* Build configuration list for PBXNativeTarget "AKTagsInputViewExampleTests" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | B9EC366C193B797C0007C5FF /* Debug */, 534 | B9EC366D193B797C0007C5FF /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | defaultConfigurationName = Release; 538 | }; 539 | /* End XCConfigurationList section */ 540 | }; 541 | rootObject = B9EC362E193B797C0007C5FF /* Project object */; 542 | } 543 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/project.xcworkspace/xcshareddata/AKTagsInputViewExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 8EFC0331-89B6-4001-B983-26EF84479244 9 | IDESourceControlProjectName 10 | AKTagsInputViewExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 7CC85E6ACDC6E2910020B6A909DB9FA0791A46E2 14 | https://github.com/purrrminator/AKTagsInputView.git 15 | 16 | IDESourceControlProjectPath 17 | AKTagsInputViewExample.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 7CC85E6ACDC6E2910020B6A909DB9FA0791A46E2 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/purrrminator/AKTagsInputView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 7CC85E6ACDC6E2910020B6A909DB9FA0791A46E2 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 7CC85E6ACDC6E2910020B6A909DB9FA0791A46E2 36 | IDESourceControlWCCName 37 | AKTagsInputViewExample 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/project.xcworkspace/xcuserdata/andreykadochnikov.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kas-kad/AKTagsInputView/7cd6d551e30628c5cfdb8a75553edfb59542fea5/AKTagsInputViewExample.xcodeproj/project.xcworkspace/xcuserdata/andreykadochnikov.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/project.xcworkspace/xcuserdata/andreykadochnikov.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/xcuserdata/andreykadochnikov.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/xcuserdata/andreykadochnikov.xcuserdatad/xcschemes/AKTagsInputViewExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /AKTagsInputViewExample.xcodeproj/xcuserdata/andreykadochnikov.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AKTagsInputViewExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B9EC3635193B797C0007C5FF 16 | 17 | primary 18 | 19 | 20 | B9EC3656193B797C0007C5FF 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/AKAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKAppDelegate.h 3 | // AKTagsInputViewExample 4 | // 5 | // Created by Andrey Kadochnikov on 01.06.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AKAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/AKAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKAppDelegate.m 3 | // AKTagsInputViewExample 4 | // 5 | // Created by Andrey Kadochnikov on 01.06.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #import "AKAppDelegate.h" 10 | #import "AKViewController.h" 11 | 12 | @implementation AKAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | self.window.backgroundColor = [UIColor whiteColor]; 18 | [self.window makeKeyAndVisible]; 19 | self.window.rootViewController = [[AKViewController alloc] init]; 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application 24 | { 25 | // 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. 26 | // 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. 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application 30 | { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | - (void)applicationWillEnterForeground:(UIApplication *)application 36 | { 37 | // 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. 38 | } 39 | 40 | - (void)applicationDidBecomeActive:(UIApplication *)application 41 | { 42 | // 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. 43 | } 44 | 45 | - (void)applicationWillTerminate:(UIApplication *)application 46 | { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/AKTagsInputViewExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | AK.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/AKTagsInputViewExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/AKViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKViewController.h 3 | // AKTagsInputViewExample 4 | // 5 | // Created by Andrey Kadochnikov on 01.06.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AKViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/AKViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKViewController.m 3 | // AKTagsInputViewExample 4 | // 5 | // Created by Andrey Kadochnikov on 01.06.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | #import "AKTagsDefines.h" 9 | #import "AKTagsInputView.h" 10 | #import "AKViewController.h" 11 | 12 | @interface AKViewController () 13 | { 14 | AKTagsInputView *_tagsInputView; 15 | } 16 | @end 17 | 18 | @implementation AKViewController 19 | 20 | #pragma mark - This is what you are looking for: 21 | -(AKTagsInputView*)createTagsInputView 22 | { 23 | _tagsInputView = [[AKTagsInputView alloc] initWithFrame:CGRectMake(0, 80.0f, CGRectGetWidth(self.view.bounds), 44.0f)]; 24 | _tagsInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 25 | _tagsInputView.lookupTags = @[@"ios", @"iphone", @"objective-c", @"development", @"cocoa", @"xcode", @"icloud"]; 26 | _tagsInputView.selectedTags = [NSMutableArray arrayWithArray:@[@"some", @"predefined", @"tags"]]; 27 | _tagsInputView.enableTagsLookup = YES; 28 | return _tagsInputView; 29 | } 30 | -(void)btnPressed:(id)sender 31 | { 32 | [[[UIAlertView alloc] initWithTitle:@"Selected tags" message:[_tagsInputView.selectedTags componentsJoinedByString:@", "] delegate:nil cancelButtonTitle:@"Nice!" otherButtonTitles: nil] show]; 33 | } 34 | 35 | 36 | #pragma mark - some other UI stuff 37 | - (void)viewDidLoad 38 | { 39 | [super viewDidLoad]; 40 | self.view.backgroundColor = WK_COLOR(200, 200, 200, 1); 41 | [self.view addSubview:[self createLabel]]; 42 | [self.view addSubview:[self createTagsInputView]]; 43 | [self.view addSubview:[self createButton]]; 44 | } 45 | 46 | -(void)viewDidAppear:(BOOL)animated 47 | { 48 | [super viewDidAppear:animated]; 49 | } 50 | 51 | -(UIButton*)createButton 52 | { 53 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(_tagsInputView.frame)+15, 290, 44)]; 54 | [btn setTitle:@"Display selected tags" forState:UIControlStateNormal]; 55 | btn.titleLabel.font = AVENIR_NEXT(17); 56 | [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; 57 | [btn addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside]; 58 | return btn; 59 | } 60 | 61 | -(UILabel*)createLabel 62 | { 63 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 55, 290, 24)];; 64 | label.textAlignment = NSTextAlignmentLeft; 65 | label.text = @"TAGS"; 66 | label.font = AVENIR_NEXT(14); 67 | return label; 68 | } 69 | @end 70 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /AKTagsInputViewExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /AKTagsInputViewExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AKTagsInputViewExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AKTagsInputViewExample 4 | // 5 | // Created by Andrey Kadochnikov on 01.06.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AKAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AKAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AKTagsInputViewExampleTests/AKTagsInputViewExampleTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | AK.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AKTagsInputViewExampleTests/AKTagsInputViewExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsInputViewExampleTests.m 3 | // AKTagsInputViewExampleTests 4 | // 5 | // Created by Andrey Kadochnikov on 01.06.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AKTagsInputViewExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AKTagsInputViewExampleTests 16 | 17 | - (void)setUp 18 | { 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 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /AKTagsInputViewExampleTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Classes/AKTagCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagCell.h 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import 9 | @class AKTagCell; 10 | @protocol AKTagCellDelegate 11 | -(void)tagCellDidPressedDelete:(AKTagCell*)cell; 12 | @end 13 | 14 | @interface AKTagCell : UICollectionViewCell 15 | @property (nonatomic, strong) UIButton *deleteButton; 16 | @property (nonatomic, strong) UILabel *tagLabel; 17 | @property (nonatomic, strong) NSString *tagName; 18 | @property (nonatomic, assign) BOOL showDeleteButton; 19 | @property (nonatomic, weak) id delegate; 20 | @property (nonatomic, readonly) BOOL isReadyForDelete; 21 | -(void)prepareForDelete; 22 | -(void)resetReadyForDeleteStatus; 23 | +(CGSize)preferredSizeWithTag:(NSString*)tag deleteButtonEnabled:(BOOL)deleteButtonEnabled; 24 | @end 25 | -------------------------------------------------------------------------------- /Classes/AKTagCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagCell.m 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | #import "AKTagsDefines.h" 8 | #import "AKTagCell.h" 9 | #import "NSString+StringSizeWithFont.h" 10 | #define TAG_CELL_PADDING 5.0f 11 | #define TAG_CELL_BTN_W 14.0f 12 | #define TAG_CELL_H 25.0f 13 | 14 | 15 | @interface AKTagCell () 16 | { 17 | BOOL isAvailableForDelete; 18 | } 19 | @end 20 | 21 | @implementation AKTagCell 22 | 23 | - (id)initWithFrame:(CGRect)frame 24 | { 25 | self = [super initWithFrame:frame]; 26 | if (self) { 27 | self.backgroundColor = WK_COLOR_GRAY_244; 28 | self.layer.cornerRadius = 3; 29 | self.clipsToBounds = YES; 30 | 31 | _tagLabel = [[UILabel alloc] initWithFrame:self.bounds]; 32 | _tagLabel.frame = UIEdgeInsetsInsetRect(_tagLabel.frame, UIEdgeInsetsMake(0, TAG_CELL_PADDING, 0, TAG_CELL_PADDING)); 33 | _tagLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 34 | _tagLabel.font = TAG_CELL_FONT; 35 | _tagLabel.textColor = WK_COLOR_GRAY_77; 36 | 37 | [self addSubview:_tagLabel]; 38 | } 39 | return self; 40 | } 41 | 42 | -(void)setShowDeleteButton:(BOOL)showDeleteButton 43 | { 44 | _showDeleteButton = showDeleteButton; 45 | if (_showDeleteButton){ 46 | [self addSubview:[self deleteButton]]; 47 | } 48 | } 49 | -(void)resetReadyForDeleteStatus 50 | { 51 | _deleteButton.enabled = NO; 52 | } 53 | -(BOOL)isReadyForDelete 54 | { 55 | return _deleteButton.enabled; 56 | } 57 | -(void)prepareForDelete 58 | { 59 | _deleteButton.enabled = YES; 60 | } 61 | -(void)setSelected:(BOOL)selected 62 | { 63 | [super setSelected:selected]; 64 | if (selected){ 65 | [self prepareForDelete]; 66 | } else { 67 | [self resetReadyForDeleteStatus]; 68 | } 69 | } 70 | 71 | -(UIButton *)deleteButton 72 | { 73 | if (!_deleteButton){ 74 | _deleteButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.bounds) - TAG_CELL_BTN_W - TAG_CELL_PADDING, CGRectGetMidY(self.bounds)-TAG_CELL_BTN_W/2, TAG_CELL_BTN_W, TAG_CELL_BTN_W)]; 75 | [_deleteButton setBackgroundImage:[UIImage imageNamed:@"cross_red_icon"] forState:UIControlStateNormal]; 76 | [_deleteButton setBackgroundImage:[UIImage imageNamed:@"cross_icon"] forState:UIControlStateDisabled]; 77 | _deleteButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 78 | _deleteButton.enabled = NO; 79 | [_deleteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 80 | [_deleteButton addTarget:self action:@selector(deleteButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; 81 | _tagLabel.frame = UIEdgeInsetsInsetRect(_tagLabel.frame, UIEdgeInsetsMake(0, 0, 0, TAG_CELL_BTN_W + TAG_CELL_PADDING)); 82 | } 83 | return _deleteButton; 84 | } 85 | 86 | -(void)deleteButtonPressed:(id)sender 87 | { 88 | [_delegate tagCellDidPressedDelete:self]; 89 | } 90 | 91 | -(void)setTagName:(NSString *)tagName 92 | { 93 | _tagName = tagName; 94 | _tagLabel.text = _tagName; 95 | } 96 | 97 | +(CGSize)preferredSizeWithTag:(NSString*)tag deleteButtonEnabled:(BOOL)deleteButtonEnabled 98 | { 99 | CGFloat tagW = [tag sizeWithMyFont:TAG_CELL_FONT].width; 100 | CGFloat deleteButtonW = (deleteButtonEnabled ? (TAG_CELL_BTN_W + TAG_CELL_PADDING) : 0); 101 | CGSize itemSize = CGSizeMake(tagW + 2*TAG_CELL_PADDING + deleteButtonW, TAG_CELL_H); 102 | return itemSize; 103 | } 104 | @end 105 | -------------------------------------------------------------------------------- /Classes/AKTagTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagTextFieldCell.h 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "AKTextField.h" 10 | @interface AKTagTextFieldCell : UICollectionViewCell 11 | @property (nonatomic, strong) AKTextField *textField; 12 | @end 13 | -------------------------------------------------------------------------------- /Classes/AKTagTextFieldCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagTextFieldCell.m 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import "AKTagTextFieldCell.h" 9 | @implementation AKTagTextFieldCell 10 | 11 | - (id)initWithFrame:(CGRect)frame 12 | { 13 | self = [super initWithFrame:frame]; 14 | if (self) { 15 | _textField = [[AKTextField alloc] initWithFrame:self.contentView.bounds]; 16 | _textField.frame = CGRectInset(_textField.frame, 0, 5); 17 | _textField.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 18 | _textField.buttonPlaceholder = @"+ Add"; 19 | _textField.autocorrectionType = UITextAutocorrectionTypeNo; 20 | [self.contentView addSubview:_textField]; 21 | } 22 | return self; 23 | } 24 | @end 25 | -------------------------------------------------------------------------------- /Classes/AKTagsDefines.h: -------------------------------------------------------------------------------- 1 | #define WK_COLOR(R, G, B, A)[UIColor colorWithRed:(R)/(255.0) green:(G)/(255.0) blue:(B)/(255.0) alpha:(A)] 2 | #define WK_COLOR_GRAY_77 WK_COLOR(77,77,77,1) 3 | #define WK_COLOR_GRAY_244 WK_COLOR(244,244,244,1) 4 | #define TAG_CELL_FONT AVENIR_NEXT(17) 5 | #define AVENIR_NEXT(_size) ([UIFont fontWithName:@"AvenirNext-Regular" size:(_size)]) 6 | #define WK_COLOR_RED_TAG_COLOR WK_COLOR(212,0,0,1) 7 | #define WK_COLOR_GREED_COLOR WK_COLOR(120,220,160,1) 8 | #define WK_COLOR_DARK_RED_TAG_COLOR WK_COLOR(180,0,0,1) -------------------------------------------------------------------------------- /Classes/AKTagsInputView.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsInputView.h 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import "AKTagsListView.h" 9 | #define DEFAULT_FORBIDDEN_CHARS_STRING (@"!$%^&*+.") // these chars are standart hashtags forbidden ones, but I'd allow 'space' char 10 | 11 | @class AKTagsInputView; 12 | @protocol AKTagsInputViewDelegate 13 | @optional 14 | -(BOOL)validateTag:(NSString*)tagName; 15 | -(void)tagsInputViewDidBeginEditing:(AKTagsInputView*)inputView; 16 | -(void)tagsInputViewDidEndEditing:(AKTagsInputView*)inputView; 17 | -(void)tagsInputViewDidAddTag:(AKTagsInputView*)inputView; 18 | -(void)tagsInputViewDidRemoveTag:(AKTagsInputView*)inputView; 19 | @end 20 | 21 | @interface AKTagsInputView : AKTagsListView 22 | 23 | @property (nonatomic, weak) id delegate; 24 | /** 25 | Forbidden chars are defined by default charstring: '!$%^&*+.' Which are default for hashtag standart. 26 | But unlike the standart the 'space' symbol is allowed to use in tags name. 27 | */ 28 | @property (nonatomic, strong) NSString* forbiddenCharsString; 29 | 30 | /** 31 | The property by default is set to 'NO'. 32 | You can finish and insert particular tag into a list of selected tags by typing ',' coma symbol. 33 | Space symbol by default can be used in tag's name (unlikely hashtags manner). 34 | Set this property to 'YES' if you want to separate your tags with 'space' symbol. 35 | */ 36 | @property (nonatomic, assign) BOOL separateTagsWithSpaceSymbol; 37 | 38 | /** 39 | 40 | */ 41 | @property (nonatomic, assign) BOOL enableTagsLookup; 42 | @property (nonatomic, strong) NSArray *lookupTags; 43 | @end 44 | -------------------------------------------------------------------------------- /Classes/AKTagsInputView.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsInputView.m 3 | // handmash 4 | // 5 | // Created by Andrey Kadochnikov on 30.05.14. 6 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #import "AKTagsInputView.h" 10 | #import "AKTagTextFieldCell.h" 11 | #import "AKTagsLookup.h" 12 | #import "Constants.h" 13 | 14 | @interface AKTagsInputView () 15 | { 16 | AKTagTextFieldCell *_textFieldCell; 17 | AKTagsLookup *_lookup; 18 | } 19 | @property (nonatomic, assign) BOOL insertingInProgress; 20 | @end 21 | 22 | @implementation AKTagsInputView 23 | 24 | -(id)initWithFrame:(CGRect)frame 25 | { 26 | if (self = [super initWithFrame:frame]){ 27 | self.allowDeleteTags = YES; 28 | _insertingInProgress = NO; 29 | _forbiddenCharsString = DEFAULT_FORBIDDEN_CHARS_STRING; 30 | [self.collectionView registerClass:[AKTagTextFieldCell class] forCellWithReuseIdentifier:@"textFieldCell"]; 31 | } 32 | return self; 33 | } 34 | 35 | #pragma mark - CV Layout 36 | -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 37 | { 38 | if (indexPath.row == self.selectedTags.count){ 39 | return CGSizeMake(CGRectGetWidth(self.collectionView.bounds)/2, CGRectGetHeight(self.bounds)); 40 | } else { 41 | return [super collectionView:collectionView layout:collectionViewLayout sizeForItemAtIndexPath:indexPath]; 42 | } 43 | } 44 | 45 | #pragma mark - CV Datasource 46 | -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 47 | { 48 | // +1 extra cell for the textFieldCell 49 | return [super collectionView:collectionView numberOfItemsInSection:section] + 1; 50 | } 51 | 52 | -(void)configureCell:(UICollectionViewCell*)cell atIndexPath:(NSIndexPath*)indexPath 53 | { 54 | // empty implementation for default gray-style cell's look 55 | } 56 | 57 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 58 | { 59 | if (indexPath.row == self.selectedTags.count){ 60 | if (!_textFieldCell){ // I don't want my CV to nullify my textFieldCell's content while reusing cells, I store the cell in memory 61 | _textFieldCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"textFieldCell" forIndexPath:indexPath]; 62 | _textFieldCell.textField.delegate = self; 63 | if (_enableTagsLookup){ 64 | _lookup = [[AKTagsLookup alloc] initWithTags:_lookupTags]; 65 | _lookup.delegate = self; 66 | [_lookup filterLookupWithPredicate:[self predicateExcludingTags:self.selectedTags]]; 67 | _textFieldCell.textField.inputAccessoryView = _lookup; 68 | } 69 | } 70 | return _textFieldCell; 71 | } else { 72 | return [super collectionView:collectionView cellForItemAtIndexPath:indexPath]; 73 | } 74 | } 75 | 76 | #pragma mark - tags lookup delegate 77 | -(void)tagsLookup:(AKTagsLookup *)lookup didSelectTag:(NSString *)tag 78 | { 79 | [self addNewItemWithString:tag completion:nil]; 80 | } 81 | 82 | #pragma mark - textFieldCell's delegate 83 | -(void)textFieldDidBeginEditing:(AKTextField *)textField 84 | { 85 | [self restoreZWWSIfNeeded:textField]; 86 | if ([self.delegate respondsToSelector:@selector(tagsInputViewDidBeginEditing:)]){ 87 | [self.delegate tagsInputViewDidBeginEditing:self]; 88 | } 89 | } 90 | -(void)textFieldDidEndEditing:(AKTextField *)textField 91 | { 92 | if ([self canInsertNewTagName:textField.text]){ 93 | [self addNewItemWithString:textField.tagName completion:nil]; 94 | } 95 | textField.text = nil; 96 | if ([self.delegate respondsToSelector:@selector(tagsInputViewDidEndEditing:)]){ 97 | [self.delegate tagsInputViewDidEndEditing:self]; 98 | } 99 | } 100 | -(BOOL)canInsertNewTagName:(NSString *)tagName 101 | { 102 | tagName = [self trimmedString:tagName]; 103 | if ([self tagNameIsNotEmpty:tagName]){ 104 | return YES; 105 | } else { 106 | return NO; 107 | } 108 | } 109 | -(BOOL)textFieldShouldReturn:(AKTextField *)textField 110 | { 111 | if ([self canInsertNewTagName:textField.text]){ 112 | [self addNewItemWithString:textField.tagName completion:nil]; 113 | } 114 | return YES; 115 | } 116 | 117 | - (void)restoreZWWSIfNeeded:(AKTextField *)textField 118 | { 119 | if ([textField.text rangeOfString:ZWWS].location == NSNotFound){ 120 | textField.text = [NSString stringWithFormat:@"%@%@", ZWWS, textField.tagName]; 121 | } 122 | } 123 | 124 | -(BOOL)textField:(AKTextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 125 | { 126 | if (self.insertingInProgress){ 127 | return NO; 128 | } 129 | BOOL isBackSpace = NO; 130 | AKTagCell *lastTagCell; 131 | if (self.selectedTags.count){ 132 | lastTagCell = (AKTagCell*)[self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:self.selectedTags.count-1 inSection:0]]; 133 | } 134 | if ([string isEqualToString:@""]){ 135 | isBackSpace = YES; 136 | 137 | if ([textField.text rangeOfString:ZWWS].location == 0 && textField.text.length == 1 && self.selectedTags.count){ 138 | if (!lastTagCell.isReadyForDelete) { 139 | [lastTagCell prepareForDelete]; 140 | return NO; 141 | } else { 142 | [self deleteItemAt:[NSIndexPath indexPathForRow:self.selectedTags.count-1 inSection:0] completion:nil]; 143 | return NO; 144 | } 145 | } 146 | } 147 | 148 | if (!isBackSpace){ 149 | [lastTagCell resetReadyForDeleteStatus]; 150 | NSCharacterSet *forbiddenCharSet = [NSCharacterSet characterSetWithCharactersInString:_forbiddenCharsString]; 151 | string = [string stringByTrimmingCharactersInSet:forbiddenCharSet]; 152 | 153 | if (string.length == 0){ 154 | textField.backgroundColor = [UIColor redColor]; 155 | [UIView animateWithDuration:0.3f animations:^{ 156 | textField.backgroundColor = [UIColor whiteColor]; 157 | }]; 158 | return NO; 159 | } 160 | 161 | if ([string isEqualToString:@","] || (_separateTagsWithSpaceSymbol && [string isEqualToString:@" "])){ 162 | if ([self canInsertNewTagName:textField.tagName]){ 163 | [self addNewItemWithString:textField.tagName completion:nil]; 164 | } 165 | return NO; 166 | } 167 | } 168 | 169 | NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string]; 170 | NSMutableString *mutableText = [newText mutableCopy]; 171 | if ([newText rangeOfString:ZWWS].location != NSNotFound){ 172 | NSRange ZWWSRange = [newText rangeOfString:ZWWS]; 173 | [mutableText deleteCharactersInRange:ZWWSRange]; 174 | } 175 | newText = [NSString stringWithString:mutableText]; 176 | if (newText.length > 0){ 177 | [_lookup filterLookupWithPredicate: [self predicateExcludingTags:self.selectedTags andFilterByString: newText]]; 178 | } else { 179 | [_lookup filterLookupWithPredicate: [self predicateExcludingTags: self.selectedTags]]; 180 | } 181 | 182 | [self restoreZWWSIfNeeded:textField]; 183 | 184 | return YES; 185 | } 186 | 187 | -(BOOL)isFirstResponder 188 | { 189 | return _textFieldCell.isFirstResponder; 190 | } 191 | -(BOOL)resignFirstResponder 192 | { 193 | return [_textFieldCell resignFirstResponder]; 194 | } 195 | -(BOOL)becomeFirstResponder 196 | { 197 | return [_textFieldCell becomeFirstResponder]; 198 | } 199 | #pragma mark - Overridden 200 | -(void)addNewItemWithString:(NSString *)string completion:(void (^)(void))completion 201 | { 202 | self.insertingInProgress = YES; 203 | [_lookup filterLookupWithPredicate: [self predicateExcludingTags: [self.selectedTags arrayByAddingObject:string]]]; 204 | 205 | _textFieldCell.textField.text = nil; 206 | __weak typeof(_textFieldCell) weakCell = _textFieldCell; 207 | __weak typeof(self) weakSelf = self; 208 | [super addNewItemWithString:string completion:^{ 209 | [weakSelf restoreZWWSIfNeeded:weakCell.textField]; 210 | weakSelf.insertingInProgress = NO; 211 | if (completion){ 212 | completion(); 213 | } 214 | }]; 215 | if ([self.delegate respondsToSelector:@selector(tagsInputViewDidAddTag:)]){ 216 | [self.delegate tagsInputViewDidAddTag:self]; 217 | } 218 | } 219 | 220 | - (void)deleteItemAt:(NSIndexPath *)indexPath completion:(void (^)(void))completion 221 | { 222 | __weak typeof(_textFieldCell) weakCell = _textFieldCell; 223 | __weak typeof(self) weakSelf = self; 224 | [super deleteItemAt:indexPath completion:^{ 225 | 226 | [weakSelf restoreZWWSIfNeeded:weakCell.textField]; 227 | 228 | if (completion){ 229 | completion(); 230 | } 231 | [_lookup filterLookupWithPredicate: [self predicateExcludingTags:self.selectedTags]]; 232 | }]; 233 | if ([self.delegate respondsToSelector:@selector(tagsInputViewDidRemoveTag:)]){ 234 | [self.delegate tagsInputViewDidRemoveTag:self]; 235 | } 236 | } 237 | 238 | #pragma mark - Helpers 239 | -(void)setSelectedTags:(NSMutableArray *)selectedTags 240 | { 241 | [super setSelectedTags:selectedTags]; 242 | } 243 | -(NSString *)trimmedString:(NSString *)str 244 | { 245 | return [str stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]]; 246 | } 247 | -(BOOL)tagNameIsNotEmpty:(NSString*)tagName 248 | { 249 | NSString *textFieldTrimmedContent = [self trimmedString:tagName]; 250 | return textFieldTrimmedContent.length > 0; 251 | } 252 | -(BOOL)tagNameIsValid:(NSString*)tagName 253 | { 254 | if (![self tagNameIsNotEmpty:tagName]){ 255 | return NO; 256 | } 257 | BOOL isValid = NO; 258 | if ([self.delegate respondsToSelector:@selector(validateTag:)]){ 259 | isValid = [self.delegate validateTag:tagName]; 260 | } 261 | return isValid; 262 | } 263 | 264 | -(NSPredicate*)predicateExcludingTags:(NSArray*)tagsToExclude andFilterByString:(NSString*)string 265 | { 266 | return [NSCompoundPredicate andPredicateWithSubpredicates:@[[self predicateExcludingTags:tagsToExclude], [NSPredicate predicateWithFormat:@"self BEGINSWITH[cd] %@", string]]]; 267 | } 268 | 269 | -(NSPredicate*)predicateExcludingTags:(NSArray*)tagsToExclude 270 | { 271 | return [NSPredicate predicateWithFormat:@"NOT(self IN %@)", tagsToExclude]; 272 | } 273 | 274 | @end 275 | -------------------------------------------------------------------------------- /Classes/AKTagsListView.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsListView.h 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "AKTagCell.h" 10 | 11 | #define CONTENT_LEFT_MARGIN 15.0f 12 | 13 | @class AKTagsListView; 14 | @protocol AKTagsListViewDelegate 15 | -(void)tagsListView:(AKTagsListView*)tagsView didSelectTag:(NSString*)tag atIndexPath:(NSIndexPath*)indexPath; 16 | @end 17 | 18 | @interface AKTagsListView : UIView 19 | < 20 | AKTagCellDelegate, 21 | UICollectionViewDelegate, 22 | UICollectionViewDataSource, 23 | UICollectionViewDelegateFlowLayout 24 | > 25 | @property (nonatomic, weak) id delegate; 26 | 27 | /** 28 | The property defines whether tags can be deleted from the list or not. 29 | If the property is set to 'YES' the delete button is displayed on the left of tag's name. 30 | */ 31 | @property (nonatomic, assign) BOOL allowDeleteTags; 32 | @property (nonatomic, strong) UICollectionView *collectionView; 33 | 34 | /** 35 | The property defines tags contained in collection. 36 | */ 37 | @property (nonatomic, strong) NSMutableArray *selectedTags; 38 | 39 | -(void)addNewItemWithString:(NSString *)string completion:(void(^)(void))completion; 40 | -(void)configureCell:(UICollectionViewCell*)cell atIndexPath:(NSIndexPath*)indexPath; 41 | -(void)deleteItemAt:(NSIndexPath *)indexPath completion:(void(^)(void))completion; 42 | @end 43 | -------------------------------------------------------------------------------- /Classes/AKTagsListView.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsListView.m 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | #import "AKTagsDefines.h" 8 | #import "AKTagsListView.h" 9 | #import "NSString+StringSizeWithFont.h" 10 | 11 | @implementation AKTagsListView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | frame.size.height = 44; 16 | self = [super initWithFrame:frame]; 17 | if (self) { 18 | [self addSubview:self.collectionView]; 19 | _selectedTags = [NSMutableArray array]; 20 | } 21 | return self; 22 | } 23 | 24 | -(UICollectionView*)collectionView 25 | { 26 | if (!_collectionView){ 27 | UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc] init]; 28 | flow.scrollDirection = UICollectionViewScrollDirectionHorizontal; 29 | flow.minimumLineSpacing = 10; 30 | flow.minimumInteritemSpacing = 10; 31 | flow.scrollDirection = UICollectionViewScrollDirectionHorizontal; 32 | 33 | _collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:flow]; 34 | _collectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 35 | _collectionView.dataSource = self; 36 | _collectionView.backgroundColor = [UIColor whiteColor]; 37 | _collectionView.allowsMultipleSelection = NO; 38 | _collectionView.delegate = self; 39 | _collectionView.showsHorizontalScrollIndicator = NO; 40 | _collectionView.showsVerticalScrollIndicator = NO; 41 | [_collectionView registerClass:[AKTagCell class] forCellWithReuseIdentifier:@"tagsViewCell"]; 42 | } 43 | return _collectionView; 44 | } 45 | 46 | #pragma mark - Cell delegate 47 | -(void)tagCellDidPressedDelete:(AKTagCell *)cell 48 | { 49 | NSIndexPath *indexPath = [_collectionView indexPathForCell:cell]; 50 | [self deleteItemAt:indexPath completion:nil]; 51 | } 52 | 53 | #pragma mark - CV Layout 54 | -(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section 55 | { 56 | return UIEdgeInsetsMake(0, CONTENT_LEFT_MARGIN, 0, 0); 57 | } 58 | 59 | -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 60 | { 61 | return [AKTagCell preferredSizeWithTag:self.selectedTags[indexPath.row] deleteButtonEnabled:self.allowDeleteTags]; 62 | } 63 | 64 | #pragma mark - CV Delegate 65 | -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 66 | { 67 | if ([self.delegate respondsToSelector:@selector(tagsListView:didSelectTag:atIndexPath:)]){ 68 | [self.delegate tagsListView:self didSelectTag:self.selectedTags[indexPath.row] atIndexPath:indexPath]; 69 | } 70 | } 71 | 72 | #pragma mark - CV Datasource 73 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 74 | { 75 | return self.selectedTags.count; 76 | } 77 | 78 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 79 | { 80 | AKTagCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"tagsViewCell" forIndexPath:indexPath]; 81 | cell.tagName = self.selectedTags[indexPath.row]; 82 | cell.delegate = self; 83 | cell.showDeleteButton = self.allowDeleteTags; 84 | [self configureCell:cell atIndexPath:indexPath]; 85 | return cell; 86 | } 87 | 88 | -(void)configureCell:(AKTagCell*)cell atIndexPath:(NSIndexPath*)indexPath 89 | { 90 | cell.backgroundColor = WK_COLOR_RED_TAG_COLOR; 91 | cell.tagLabel.textColor = [UIColor whiteColor]; 92 | cell.layer.borderWidth = 1; 93 | cell.layer.borderColor = WK_COLOR_DARK_RED_TAG_COLOR.CGColor; 94 | } 95 | 96 | #pragma mark - Helpers 97 | -(NSString*)squashWhitespaces:(NSString*)string 98 | { 99 | NSString *result = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 100 | NSArray *components = [result componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 101 | components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self <> ''"]]; 102 | result = [components componentsJoinedByString:@" "]; 103 | return result; 104 | } 105 | 106 | - (void)scrollListInsertingItem:(NSString *)string 107 | { 108 | CGFloat width = CGRectGetWidth(self.bounds); 109 | CGFloat contentXOffset = (self.collectionView.contentSize.width - width); 110 | contentXOffset = MAX(contentXOffset + [AKTagCell preferredSizeWithTag:string deleteButtonEnabled:_allowDeleteTags].width, 0); 111 | CGPoint offset = CGPointMake(contentXOffset, 0); 112 | [self.collectionView setContentOffset:offset animated:YES]; 113 | } 114 | 115 | - (void)addNewItemWithString:(NSString *)string completion:(void(^)(void))compeltion 116 | { 117 | NSString *squashedString = [self squashWhitespaces:string]; 118 | [self.selectedTags addObject:squashedString]; 119 | 120 | [self scrollListInsertingItem:string]; 121 | 122 | // this is a workaround of a big problem when CV resigns first responder while dequeue cells. 123 | // so that my textfield cell may become to unwanted state and get into an UI mess 124 | // I have to insert new cells only having textfield cell visible, so first I scroll to it and only after that 125 | // I insert new item 126 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 127 | [self.collectionView performBatchUpdates:^{ 128 | 129 | [self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForRow:self.selectedTags.count-1 inSection:0]]]; 130 | } completion:^(BOOL finished) { 131 | if (compeltion){ 132 | compeltion(); 133 | } 134 | }]; 135 | }); 136 | } 137 | 138 | - (void)deleteItemAt:(NSIndexPath *)indexPath completion:(void(^)(void))completion 139 | { 140 | [self.collectionView deselectItemAtIndexPath:indexPath animated:YES]; 141 | [self.collectionView performBatchUpdates:^{ 142 | NSArray* itemPaths = @[indexPath]; 143 | [self deleteItemsFromDataSourceAtIndexPaths:itemPaths]; 144 | [self.collectionView deleteItemsAtIndexPaths:itemPaths]; 145 | } completion: ^(BOOL finished){ 146 | if (completion){ 147 | completion(); 148 | } 149 | }]; 150 | } 151 | 152 | -(void)deleteItemsFromDataSourceAtIndexPaths:(NSArray*)ipaths 153 | { 154 | for (NSIndexPath *ip in ipaths){ 155 | [self.selectedTags removeObjectAtIndex:ip.row]; 156 | } 157 | } 158 | @end 159 | -------------------------------------------------------------------------------- /Classes/AKTagsLookup.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsLookup.h 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import 9 | @class AKTagsLookup; 10 | @protocol AKTagsLookupDelegate 11 | -(void)tagsLookup:(AKTagsLookup*)lookup didSelectTag:(NSString*)tag; 12 | @end 13 | 14 | @interface AKTagsLookup : UIView 15 | @property (nonatomic, weak) id delegate; 16 | -(id)initWithTags:(NSArray*)tags; 17 | -(void)filterLookupWithPredicate:(NSPredicate*)predicate; 18 | @end 19 | -------------------------------------------------------------------------------- /Classes/AKTagsLookup.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTagsLookup.m 3 | // 4 | // Created by Andrey Kadochnikov on 30.05.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import "AKTagsLookup.h" 9 | #import "AKTagsListView.h" 10 | 11 | @interface AKTagsLookup () 12 | { 13 | AKTagsListView *_tagsView; 14 | NSMutableArray *_tagsBase; 15 | } 16 | @end 17 | 18 | @implementation AKTagsLookup 19 | 20 | -(id)initWithTags:(NSArray *)tags 21 | { 22 | self = [super initWithFrame:CGRectMake(0, 0, CGRectGetWidth([UIScreen mainScreen].bounds), 44)]; 23 | if (self) { 24 | _tagsBase = [NSMutableArray arrayWithArray:tags]; 25 | _tagsView = [[AKTagsListView alloc] initWithFrame:self.bounds]; 26 | _tagsView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 27 | _tagsView.selectedTags = [NSMutableArray arrayWithArray:tags]; 28 | _tagsView.backgroundColor = [UIColor clearColor]; 29 | _tagsView.collectionView.backgroundColor = [UIColor clearColor]; 30 | _tagsView.delegate = self; 31 | self.backgroundColor = [UIColor clearColor]; 32 | [self addSubview:_tagsView]; 33 | } 34 | return self; 35 | } 36 | 37 | -(void)filterLookupWithPredicate:(NSPredicate *)predicate 38 | { 39 | [_tagsView.collectionView performBatchUpdates:^{ 40 | NSMutableArray *filteredTags = [[_tagsBase filteredArrayUsingPredicate:predicate] mutableCopy]; 41 | _tagsView.selectedTags = filteredTags; 42 | [_tagsView.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]]; 43 | 44 | } completion:^(BOOL finished) { 45 | 46 | }]; 47 | } 48 | 49 | -(void)tagsListView:(AKTagsListView *)tagsView didSelectTag:(NSString *)tag atIndexPath:(NSIndexPath *)indexPath 50 | { 51 | // [_tagsView deleteItemAt:indexPath]; 52 | if ([self.delegate respondsToSelector:@selector(tagsLookup:didSelectTag:)]){ 53 | [self.delegate tagsLookup:self didSelectTag:tag]; 54 | } 55 | } 56 | @end 57 | -------------------------------------------------------------------------------- /Classes/AKTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // AKTextField.h 3 | // 4 | // Created by Andrey Kadochnikov on 02.06.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface AKTextField : UITextField 11 | @property (nonatomic, strong) NSString *buttonPlaceholder; 12 | @property (nonatomic, strong) UIColor *buttonPlaceholderColor; 13 | @property (nonatomic, readonly) NSString *tagName; 14 | @end 15 | -------------------------------------------------------------------------------- /Classes/AKTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // AKTextField.m 3 | // 4 | // Created by Andrey Kadochnikov on 02.06.14. 5 | // Copyright (c) 2014 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import "AKTextField.h" 9 | #import "NSString+StringSizeWithFont.h" 10 | #import "Constants.h" 11 | 12 | @implementation AKTextField{ 13 | BOOL _shouldDrawPlaceholder; 14 | } 15 | 16 | -(id)init{ 17 | if (self = [super init]){ 18 | [self _initialize]; 19 | } 20 | return self; 21 | } 22 | - (id)initWithFrame:(CGRect)frame 23 | { 24 | self = [super initWithFrame:frame]; 25 | if (self) { 26 | [self _initialize]; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)_initialize { 32 | self.buttonPlaceholderColor = [UIColor colorWithWhite:0.8f alpha:1.0f]; 33 | _shouldDrawPlaceholder = NO; 34 | } 35 | 36 | -(BOOL)becomeFirstResponder{ 37 | BOOL result = [super becomeFirstResponder]; 38 | [self _updateShouldDrawPlaceholder]; 39 | return result; 40 | } 41 | -(BOOL)resignFirstResponder{ 42 | BOOL result = [super resignFirstResponder]; 43 | [self _updateShouldDrawPlaceholder]; 44 | return result; 45 | } 46 | 47 | - (void)setButtonPlaceholder:(NSString *)str{ 48 | if ([str isEqual:_buttonPlaceholder]) { 49 | return; 50 | } 51 | _buttonPlaceholder = str; 52 | [self _updateShouldDrawPlaceholder]; 53 | } 54 | 55 | - (void)_updateShouldDrawPlaceholder { 56 | BOOL prev = _shouldDrawPlaceholder; 57 | _shouldDrawPlaceholder = !self.isFirstResponder; 58 | if (prev != _shouldDrawPlaceholder) { 59 | [self setNeedsDisplay]; 60 | } 61 | } 62 | 63 | - (void)drawRect:(CGRect)rect { 64 | [super drawRect:rect]; 65 | 66 | if (_shouldDrawPlaceholder) { 67 | CGSize stringSize = [self.buttonPlaceholder sizeWithMyFont: self.font]; 68 | CGFloat stringWidth = stringSize.width; 69 | CGFloat stringHeigth = stringSize.height; 70 | CGRect stringRect = CGRectMake(8, CGRectGetMidY(rect) - stringHeigth/2, stringWidth, stringHeigth); 71 | [self.buttonPlaceholder drawInRect:stringRect withMyFont:self.font myColor:_buttonPlaceholderColor]; 72 | 73 | CGContextRef context = UIGraphicsGetCurrentContext(); 74 | CGContextSetStrokeColorWithColor(context, _buttonPlaceholderColor.CGColor); 75 | CGContextSetLineWidth(context, 1); 76 | CGFloat dashLengths[] = { 5, 3 }; 77 | CGContextSetLineDash(context, 0, dashLengths, 2); 78 | CGContextStrokeRect(context, CGRectMake(1, 6, 8 + stringWidth + 8, 22)); 79 | } 80 | } 81 | 82 | -(NSString *)tagName 83 | { 84 | NSMutableString *mutableText = self.text.mutableCopy; 85 | if ([self.text rangeOfString:ZWWS].location != NSNotFound){ 86 | NSRange ZWWSRange = [self.text rangeOfString:ZWWS]; 87 | [mutableText deleteCharactersInRange:ZWWSRange]; 88 | } 89 | return [NSString stringWithString:mutableText]; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Classes/Constants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.h 3 | // AKTagsInputViewExample 4 | // 5 | // Created by Andrey K. on 22.02.15. 6 | // Copyright (c) 2015 Andrey Kadochnikov. All rights reserved. 7 | // 8 | 9 | #define ZWWS (@"\u200b") // this invisible symbol is placed at the very first textfield element. -------------------------------------------------------------------------------- /Classes/NSString+StringSizeWithFont.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+StringsizeWithFont.h 3 | // 4 | // Created by Andrey Kadochnikov on 29.11.13. 5 | // Copyright (c) 2013 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSString (StringsizeWithFont) 11 | 12 | 13 | -(CGSize)sizeWithMyFont:(UIFont *)fontToUse; 14 | -(CGSize)sizeWithMyFont:(UIFont *)fontToUse constrainedToMySize:(CGSize)size; 15 | -(CGSize)sizeWithMyFont:(UIFont *)font constrainedToMySize:(CGSize)size myLineBreakMode:(NSLineBreakMode)lineBreakMode; 16 | -(CGSize)sizeWithMyFont:(UIFont *)font forMyWidth:(CGFloat)width myLineBreakMode:(NSLineBreakMode)lineBreakMode; 17 | 18 | -(void)drawInRect:(CGRect)rect withMyFont:(UIFont *)fontToUse myColor:(UIColor*)color; 19 | -(void)drawInRect:(CGRect)rect withMyFont:(UIFont *)font myLineBreakMode:(NSLineBreakMode)lineBreakMode myAlignment:(NSTextAlignment)alignment myColor:(UIColor*)color; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Classes/NSString+StringSizeWithFont.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+StringsizeWithMyFont.m 3 | // 4 | // Created by Andrey Kadochnikov on 29.11.13. 5 | // Copyright (c) 2013 Andrey Kadochnikov. All rights reserved. 6 | // 7 | 8 | #import "NSString+StringsizeWithFont.h" 9 | 10 | @implementation NSString (StringsizeWithFont) 11 | 12 | 13 | -(CGSize)ceiledSize:(CGSize)size{ 14 | size.height = ceilf(size.height); 15 | size.width = ceilf(size.width); 16 | return size; 17 | } 18 | 19 | - (CGSize) sizeWithMyFont:(UIFont *)fontToUse 20 | { 21 | NSDictionary* attribs = @{NSFontAttributeName:fontToUse}; 22 | return [self ceiledSize:[self sizeWithAttributes:attribs]]; 23 | } 24 | 25 | - (CGSize) sizeWithMyFont:(UIFont *)fontToUse constrainedToMySize:(CGSize)size 26 | { 27 | CGRect textRect = [self boundingRectWithSize:size 28 | options:NSStringDrawingUsesLineFragmentOrigin 29 | attributes:@{NSFontAttributeName:fontToUse} 30 | context:nil]; 31 | return [self ceiledSize:textRect.size]; 32 | } 33 | -(CGSize)sizeWithMyFont:(UIFont *)font forMyWidth:(CGFloat)width myLineBreakMode:(NSLineBreakMode)lineBreakMode{ 34 | 35 | NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; 36 | paragraphStyle.lineBreakMode = lineBreakMode; 37 | NSDictionary *attributes = @{ NSFontAttributeName: font, 38 | NSParagraphStyleAttributeName: paragraphStyle }; 39 | CGRect textRect = [self boundingRectWithSize:CGSizeMake(width, MAXFLOAT) 40 | options:NSStringDrawingUsesLineFragmentOrigin 41 | attributes:attributes 42 | context:nil]; 43 | return [self ceiledSize:textRect.size]; 44 | } 45 | 46 | -(CGSize)sizeWithMyFont:(UIFont *)font constrainedToMySize:(CGSize)size myLineBreakMode:(NSLineBreakMode)lineBreakMode{ 47 | NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; 48 | paragraphStyle.lineBreakMode = lineBreakMode; 49 | NSDictionary *attributes = @{ NSFontAttributeName: font, 50 | NSParagraphStyleAttributeName: paragraphStyle }; 51 | 52 | CGRect textRect = [self boundingRectWithSize:size 53 | options:NSStringDrawingUsesLineFragmentOrigin 54 | attributes:attributes 55 | context:nil]; 56 | return [self ceiledSize:textRect.size]; 57 | } 58 | 59 | -(void)drawInRect:(CGRect)rect withMyFont:(UIFont *)fontToUse myColor:(UIColor*)color 60 | { 61 | NSDictionary* attribs = @{NSFontAttributeName:fontToUse, NSForegroundColorAttributeName: color}; 62 | [self drawInRect:rect withAttributes:attribs]; 63 | } 64 | 65 | -(void)drawInRect:(CGRect)rect withMyFont:(UIFont *)font myLineBreakMode:(NSLineBreakMode)lineBreakMode myAlignment:(NSTextAlignment)alignment myColor:(UIColor*)color 66 | { 67 | NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; 68 | paragraphStyle.lineBreakMode = lineBreakMode; 69 | paragraphStyle.alignment = alignment; 70 | 71 | NSDictionary *attributes = @{ NSFontAttributeName: font, 72 | NSParagraphStyleAttributeName: paragraphStyle, 73 | NSForegroundColorAttributeName: color}; 74 | 75 | 76 | [self drawInRect:rect withAttributes:attributes]; 77 | } 78 | @end 79 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AKTagsInputView 2 | =============== 3 | AKTagsInputView class implements a convenient input view for seek'n'selecting and writing tags data. 4 | 5 | ##### Features 6 | - write your own tags 7 | - forbidden symbols settings 8 | - space or coma separation 9 | - lookup-style accessory input view for selecting predefined tags 10 | - fast search by first letters 11 | 12 | 13 | ### Demo 14 | (click on the gif below to watch HD youtube demo) 15 | 16 | 17 | [![CLICK TO WATCH HD DEMO](http://cdn.makeagif.com/media/6-01-2014/anzpi7.gif)](http://www.youtube.com/watch?v=WURx-ZjOATQ) 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Resources/cross_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kas-kad/AKTagsInputView/7cd6d551e30628c5cfdb8a75553edfb59542fea5/Resources/cross_icon.png -------------------------------------------------------------------------------- /Resources/cross_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kas-kad/AKTagsInputView/7cd6d551e30628c5cfdb8a75553edfb59542fea5/Resources/cross_icon@2x.png -------------------------------------------------------------------------------- /Resources/cross_red_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kas-kad/AKTagsInputView/7cd6d551e30628c5cfdb8a75553edfb59542fea5/Resources/cross_red_icon.png -------------------------------------------------------------------------------- /Resources/cross_red_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kas-kad/AKTagsInputView/7cd6d551e30628c5cfdb8a75553edfb59542fea5/Resources/cross_red_icon@2x.png --------------------------------------------------------------------------------