├── LBTagView ├── LBTagView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── luohuichao.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── luohuichao.xcuserdatad │ │ └── xcschemes │ │ ├── LBTagView.xcscheme │ │ └── xcschememanagement.plist ├── LBTagView │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── LBTagView │ │ ├── LBTagView.h │ │ └── LBTagView.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── LBTagViewTests │ ├── Info.plist │ └── LBTagViewTests.m └── LBTagViewUITests │ ├── Info.plist │ └── LBTagViewUITests.m ├── LICENSE └── README.md /LBTagView/LBTagView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A837E301C45417900943228 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A837E2F1C45417900943228 /* main.m */; }; 11 | 1A837E331C45417900943228 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A837E321C45417900943228 /* AppDelegate.m */; }; 12 | 1A837E361C45417900943228 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A837E351C45417900943228 /* ViewController.m */; }; 13 | 1A837E391C45417900943228 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A837E371C45417900943228 /* Main.storyboard */; }; 14 | 1A837E3B1C45417900943228 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A837E3A1C45417900943228 /* Assets.xcassets */; }; 15 | 1A837E3E1C45417900943228 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A837E3C1C45417900943228 /* LaunchScreen.storyboard */; }; 16 | 1A837E491C45417900943228 /* LBTagViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A837E481C45417900943228 /* LBTagViewTests.m */; }; 17 | 1A837E541C45417900943228 /* LBTagViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A837E531C45417900943228 /* LBTagViewUITests.m */; }; 18 | 1A837E641C4541A700943228 /* LBTagView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A837E631C4541A700943228 /* LBTagView.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 1A837E451C45417900943228 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 1A837E231C45417900943228 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 1A837E2A1C45417900943228; 27 | remoteInfo = LBTagView; 28 | }; 29 | 1A837E501C45417900943228 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 1A837E231C45417900943228 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 1A837E2A1C45417900943228; 34 | remoteInfo = LBTagView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1A837E2B1C45417900943228 /* LBTagView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LBTagView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 1A837E2F1C45417900943228 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | 1A837E311C45417900943228 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 1A837E321C45417900943228 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 1A837E341C45417900943228 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 44 | 1A837E351C45417900943228 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 45 | 1A837E381C45417900943228 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 1A837E3A1C45417900943228 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 1A837E3D1C45417900943228 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 1A837E3F1C45417900943228 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 1A837E441C45417900943228 /* LBTagViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LBTagViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 1A837E481C45417900943228 /* LBTagViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LBTagViewTests.m; sourceTree = ""; }; 51 | 1A837E4A1C45417900943228 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 1A837E4F1C45417900943228 /* LBTagViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LBTagViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 1A837E531C45417900943228 /* LBTagViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LBTagViewUITests.m; sourceTree = ""; }; 54 | 1A837E551C45417900943228 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 1A837E621C4541A700943228 /* LBTagView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBTagView.h; sourceTree = ""; }; 56 | 1A837E631C4541A700943228 /* LBTagView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBTagView.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 1A837E281C45417900943228 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 1A837E411C45417900943228 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 1A837E4C1C45417900943228 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 1A837E221C45417900943228 = { 85 | isa = PBXGroup; 86 | children = ( 87 | 1A837E2D1C45417900943228 /* LBTagView */, 88 | 1A837E471C45417900943228 /* LBTagViewTests */, 89 | 1A837E521C45417900943228 /* LBTagViewUITests */, 90 | 1A837E2C1C45417900943228 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 1A837E2C1C45417900943228 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 1A837E2B1C45417900943228 /* LBTagView.app */, 98 | 1A837E441C45417900943228 /* LBTagViewTests.xctest */, 99 | 1A837E4F1C45417900943228 /* LBTagViewUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 1A837E2D1C45417900943228 /* LBTagView */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 1A837E611C45419400943228 /* LBTagView */, 108 | 1A837E311C45417900943228 /* AppDelegate.h */, 109 | 1A837E321C45417900943228 /* AppDelegate.m */, 110 | 1A837E341C45417900943228 /* ViewController.h */, 111 | 1A837E351C45417900943228 /* ViewController.m */, 112 | 1A837E371C45417900943228 /* Main.storyboard */, 113 | 1A837E3A1C45417900943228 /* Assets.xcassets */, 114 | 1A837E3C1C45417900943228 /* LaunchScreen.storyboard */, 115 | 1A837E3F1C45417900943228 /* Info.plist */, 116 | 1A837E2E1C45417900943228 /* Supporting Files */, 117 | ); 118 | path = LBTagView; 119 | sourceTree = ""; 120 | }; 121 | 1A837E2E1C45417900943228 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 1A837E2F1C45417900943228 /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | 1A837E471C45417900943228 /* LBTagViewTests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 1A837E481C45417900943228 /* LBTagViewTests.m */, 133 | 1A837E4A1C45417900943228 /* Info.plist */, 134 | ); 135 | path = LBTagViewTests; 136 | sourceTree = ""; 137 | }; 138 | 1A837E521C45417900943228 /* LBTagViewUITests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 1A837E531C45417900943228 /* LBTagViewUITests.m */, 142 | 1A837E551C45417900943228 /* Info.plist */, 143 | ); 144 | path = LBTagViewUITests; 145 | sourceTree = ""; 146 | }; 147 | 1A837E611C45419400943228 /* LBTagView */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 1A837E621C4541A700943228 /* LBTagView.h */, 151 | 1A837E631C4541A700943228 /* LBTagView.m */, 152 | ); 153 | path = LBTagView; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 1A837E2A1C45417900943228 /* LBTagView */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 1A837E581C45417900943228 /* Build configuration list for PBXNativeTarget "LBTagView" */; 162 | buildPhases = ( 163 | 1A837E271C45417900943228 /* Sources */, 164 | 1A837E281C45417900943228 /* Frameworks */, 165 | 1A837E291C45417900943228 /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | ); 171 | name = LBTagView; 172 | productName = LBTagView; 173 | productReference = 1A837E2B1C45417900943228 /* LBTagView.app */; 174 | productType = "com.apple.product-type.application"; 175 | }; 176 | 1A837E431C45417900943228 /* LBTagViewTests */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 1A837E5B1C45417900943228 /* Build configuration list for PBXNativeTarget "LBTagViewTests" */; 179 | buildPhases = ( 180 | 1A837E401C45417900943228 /* Sources */, 181 | 1A837E411C45417900943228 /* Frameworks */, 182 | 1A837E421C45417900943228 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | 1A837E461C45417900943228 /* PBXTargetDependency */, 188 | ); 189 | name = LBTagViewTests; 190 | productName = LBTagViewTests; 191 | productReference = 1A837E441C45417900943228 /* LBTagViewTests.xctest */; 192 | productType = "com.apple.product-type.bundle.unit-test"; 193 | }; 194 | 1A837E4E1C45417900943228 /* LBTagViewUITests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 1A837E5E1C45417900943228 /* Build configuration list for PBXNativeTarget "LBTagViewUITests" */; 197 | buildPhases = ( 198 | 1A837E4B1C45417900943228 /* Sources */, 199 | 1A837E4C1C45417900943228 /* Frameworks */, 200 | 1A837E4D1C45417900943228 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 1A837E511C45417900943228 /* PBXTargetDependency */, 206 | ); 207 | name = LBTagViewUITests; 208 | productName = LBTagViewUITests; 209 | productReference = 1A837E4F1C45417900943228 /* LBTagViewUITests.xctest */; 210 | productType = "com.apple.product-type.bundle.ui-testing"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 1A837E231C45417900943228 /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0710; 219 | ORGANIZATIONNAME = luobbe; 220 | TargetAttributes = { 221 | 1A837E2A1C45417900943228 = { 222 | CreatedOnToolsVersion = 7.1.1; 223 | }; 224 | 1A837E431C45417900943228 = { 225 | CreatedOnToolsVersion = 7.1.1; 226 | TestTargetID = 1A837E2A1C45417900943228; 227 | }; 228 | 1A837E4E1C45417900943228 = { 229 | CreatedOnToolsVersion = 7.1.1; 230 | TestTargetID = 1A837E2A1C45417900943228; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = 1A837E261C45417900943228 /* Build configuration list for PBXProject "LBTagView" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = English; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | en, 240 | Base, 241 | ); 242 | mainGroup = 1A837E221C45417900943228; 243 | productRefGroup = 1A837E2C1C45417900943228 /* Products */; 244 | projectDirPath = ""; 245 | projectRoot = ""; 246 | targets = ( 247 | 1A837E2A1C45417900943228 /* LBTagView */, 248 | 1A837E431C45417900943228 /* LBTagViewTests */, 249 | 1A837E4E1C45417900943228 /* LBTagViewUITests */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXResourcesBuildPhase section */ 255 | 1A837E291C45417900943228 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | 1A837E3E1C45417900943228 /* LaunchScreen.storyboard in Resources */, 260 | 1A837E3B1C45417900943228 /* Assets.xcassets in Resources */, 261 | 1A837E391C45417900943228 /* Main.storyboard in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | 1A837E421C45417900943228 /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | 1A837E4D1C45417900943228 /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXResourcesBuildPhase section */ 280 | 281 | /* Begin PBXSourcesBuildPhase section */ 282 | 1A837E271C45417900943228 /* Sources */ = { 283 | isa = PBXSourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | 1A837E361C45417900943228 /* ViewController.m in Sources */, 287 | 1A837E331C45417900943228 /* AppDelegate.m in Sources */, 288 | 1A837E301C45417900943228 /* main.m in Sources */, 289 | 1A837E641C4541A700943228 /* LBTagView.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 1A837E401C45417900943228 /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 1A837E491C45417900943228 /* LBTagViewTests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 1A837E4B1C45417900943228 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 1A837E541C45417900943228 /* LBTagViewUITests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXTargetDependency section */ 312 | 1A837E461C45417900943228 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = 1A837E2A1C45417900943228 /* LBTagView */; 315 | targetProxy = 1A837E451C45417900943228 /* PBXContainerItemProxy */; 316 | }; 317 | 1A837E511C45417900943228 /* PBXTargetDependency */ = { 318 | isa = PBXTargetDependency; 319 | target = 1A837E2A1C45417900943228 /* LBTagView */; 320 | targetProxy = 1A837E501C45417900943228 /* PBXContainerItemProxy */; 321 | }; 322 | /* End PBXTargetDependency section */ 323 | 324 | /* Begin PBXVariantGroup section */ 325 | 1A837E371C45417900943228 /* Main.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 1A837E381C45417900943228 /* Base */, 329 | ); 330 | name = Main.storyboard; 331 | sourceTree = ""; 332 | }; 333 | 1A837E3C1C45417900943228 /* LaunchScreen.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 1A837E3D1C45417900943228 /* Base */, 337 | ); 338 | name = LaunchScreen.storyboard; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | 1A837E561C45417900943228 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | }; 385 | name = Debug; 386 | }; 387 | 1A837E571C45417900943228 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_CONSTANT_CONVERSION = YES; 397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 398 | CLANG_WARN_EMPTY_BODY = YES; 399 | CLANG_WARN_ENUM_CONVERSION = YES; 400 | CLANG_WARN_INT_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | VALIDATE_PRODUCT = YES; 421 | }; 422 | name = Release; 423 | }; 424 | 1A837E591C45417900943228 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 428 | INFOPLIST_FILE = LBTagView/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBTagView; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | }; 433 | name = Debug; 434 | }; 435 | 1A837E5A1C45417900943228 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | INFOPLIST_FILE = LBTagView/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBTagView; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | }; 444 | name = Release; 445 | }; 446 | 1A837E5C1C45417900943228 /* Debug */ = { 447 | isa = XCBuildConfiguration; 448 | buildSettings = { 449 | BUNDLE_LOADER = "$(TEST_HOST)"; 450 | INFOPLIST_FILE = LBTagViewTests/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 452 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBTagViewTests; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LBTagView.app/LBTagView"; 455 | }; 456 | name = Debug; 457 | }; 458 | 1A837E5D1C45417900943228 /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | BUNDLE_LOADER = "$(TEST_HOST)"; 462 | INFOPLIST_FILE = LBTagViewTests/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 464 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBTagViewTests; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LBTagView.app/LBTagView"; 467 | }; 468 | name = Release; 469 | }; 470 | 1A837E5F1C45417900943228 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | INFOPLIST_FILE = LBTagViewUITests/Info.plist; 474 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 475 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBTagViewUITests; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_TARGET_NAME = LBTagView; 478 | USES_XCTRUNNER = YES; 479 | }; 480 | name = Debug; 481 | }; 482 | 1A837E601C45417900943228 /* Release */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | INFOPLIST_FILE = LBTagViewUITests/Info.plist; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 487 | PRODUCT_BUNDLE_IDENTIFIER = com.luobbe.LBTagViewUITests; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | TEST_TARGET_NAME = LBTagView; 490 | USES_XCTRUNNER = YES; 491 | }; 492 | name = Release; 493 | }; 494 | /* End XCBuildConfiguration section */ 495 | 496 | /* Begin XCConfigurationList section */ 497 | 1A837E261C45417900943228 /* Build configuration list for PBXProject "LBTagView" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 1A837E561C45417900943228 /* Debug */, 501 | 1A837E571C45417900943228 /* Release */, 502 | ); 503 | defaultConfigurationIsVisible = 0; 504 | defaultConfigurationName = Release; 505 | }; 506 | 1A837E581C45417900943228 /* Build configuration list for PBXNativeTarget "LBTagView" */ = { 507 | isa = XCConfigurationList; 508 | buildConfigurations = ( 509 | 1A837E591C45417900943228 /* Debug */, 510 | 1A837E5A1C45417900943228 /* Release */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | }; 514 | 1A837E5B1C45417900943228 /* Build configuration list for PBXNativeTarget "LBTagViewTests" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 1A837E5C1C45417900943228 /* Debug */, 518 | 1A837E5D1C45417900943228 /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | }; 522 | 1A837E5E1C45417900943228 /* Build configuration list for PBXNativeTarget "LBTagViewUITests" */ = { 523 | isa = XCConfigurationList; 524 | buildConfigurations = ( 525 | 1A837E5F1C45417900943228 /* Debug */, 526 | 1A837E601C45417900943228 /* Release */, 527 | ); 528 | defaultConfigurationIsVisible = 0; 529 | }; 530 | /* End XCConfigurationList section */ 531 | }; 532 | rootObject = 1A837E231C45417900943228 /* Project object */; 533 | } 534 | -------------------------------------------------------------------------------- /LBTagView/LBTagView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LBTagView/LBTagView.xcodeproj/project.xcworkspace/xcuserdata/luohuichao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lovels/LBTagView/729e30cfdafba794f13dbd884e105e64ba368751/LBTagView/LBTagView.xcodeproj/project.xcworkspace/xcuserdata/luohuichao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LBTagView/LBTagView.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcschemes/LBTagView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LBTagView/LBTagView.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LBTagView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1A837E2A1C45417900943228 16 | 17 | primary 18 | 19 | 20 | 1A837E431C45417900943228 21 | 22 | primary 23 | 24 | 25 | 1A837E4E1C45417900943228 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LBTagView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LBTagView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /LBTagView/LBTagView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/LBTagView/LBTagView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBTagView.h 3 | // LBTagsView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger,LBTagDirection) 12 | { 13 | LBTagDirectionLeft, 14 | LBTagDirectionRight 15 | }; 16 | 17 | @interface LBTagView : UIView 18 | 19 | // is can be moved 20 | @property (nonatomic, assign) BOOL canMove; 21 | 22 | // text 23 | @property (nonatomic, copy) NSString *text; 24 | 25 | // default [UIColor whiteColor] 26 | @property (nonatomic, strong) UIColor *textColor; 27 | 28 | // default is LBTagDirectionLeft 29 | @property (nonatomic, assign) LBTagDirection direction; 30 | 31 | // default [UIFont systemFontOfSize:12] 32 | @property (nonatomic, strong) UIFont *font; 33 | 34 | // default [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5] 35 | @property (nonatomic, strong) UIColor *backgroundColor; 36 | 37 | // default [UIColor colorWithRed:1 green:1 blue:1 alpha:0.8] 38 | @property (nonatomic, strong) UIColor *circlrColor; 39 | 40 | // default [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7] 41 | @property (nonatomic, strong) UIColor *circlrShadowColor; 42 | 43 | // tap action 44 | @property (nonatomic, strong) UITapGestureRecognizer *tapGestureRecognizer; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/LBTagView/LBTagView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBTagView.m 3 | // LBTagsView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "LBTagView.h" 10 | 11 | @interface LBTagView () 12 | { 13 | CGPoint lastPoint; 14 | } 15 | 16 | @property (nonatomic, strong) UILabel *textLabel; 17 | 18 | @property (nonatomic, assign) CGSize circleSize;//circle size 19 | 20 | @property (nonatomic, strong) UIView *circleView; 21 | 22 | @property (nonatomic, strong) CALayer *circleLayer; 23 | 24 | @end 25 | 26 | @implementation LBTagView 27 | 28 | /* 29 | // Only override drawRect: if you perform custom drawing. 30 | // An empty implementation adversely affects performance during animation. 31 | - (void)drawRect:(CGRect)rect { 32 | // Drawing code 33 | } 34 | */ 35 | 36 | - (instancetype)initWithFrame:(CGRect)frame 37 | { 38 | if (self = [super initWithFrame:frame]) { 39 | // 40 | [self initialization]; 41 | } 42 | return self; 43 | } 44 | 45 | - (void)initialization 46 | { 47 | //add subviews 48 | _circleSize = CGSizeMake(6, 6); 49 | _canMove= YES; 50 | [self addSubview:self.textLabel]; 51 | [self creatCircleView]; 52 | //default configeration 53 | self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5]; 54 | self.textColor = [UIColor whiteColor]; 55 | self.font = [UIFont systemFontOfSize:12]; 56 | self.circlrColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.8]; 57 | self.circlrShadowColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7]; 58 | self.direction = LBTagDirectionLeft; 59 | } 60 | 61 | - (UILabel *)textLabel 62 | { 63 | if (_textLabel == nil) { 64 | // 65 | _textLabel = ({ 66 | UILabel *testView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(self.frame))]; 67 | testView.textAlignment = NSTextAlignmentCenter; 68 | [self triangle:testView]; 69 | testView; 70 | }); 71 | } 72 | return _textLabel; 73 | } 74 | 75 | - (void)triangle:(UILabel *)label 76 | { 77 | [label.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)]; 78 | CGFloat angleWidth = 10; 79 | UIBezierPath * path = [ UIBezierPath new ]; 80 | switch (self.direction) { 81 | case LBTagDirectionRight: 82 | [path moveToPoint :( CGPoint ) { 0 , 0 }]; 83 | [path addLineToPoint :( CGPoint ) { 0, CGRectGetHeight(label.frame)}]; 84 | [path addLineToPoint :( CGPoint ) { CGRectGetWidth(label.frame) - angleWidth, CGRectGetHeight(label.frame)}]; 85 | [path addLineToPoint :( CGPoint ) { CGRectGetWidth(label.frame), CGRectGetHeight(label.frame)/2.0}]; 86 | [path addLineToPoint :( CGPoint ) { CGRectGetWidth(label.frame) - angleWidth, 0}]; 87 | [path addLineToPoint :( CGPoint ) { 0, 0}]; 88 | break; 89 | case LBTagDirectionLeft: 90 | default: 91 | [path moveToPoint :( CGPoint ) { angleWidth , 0 }]; 92 | [path addLineToPoint :( CGPoint ) { 0, CGRectGetHeight(label.frame)/2.0}]; 93 | [path addLineToPoint :( CGPoint ) { angleWidth, CGRectGetHeight(label.frame)}]; 94 | [path addLineToPoint :( CGPoint ) { CGRectGetWidth(label.frame), CGRectGetHeight(label.frame)}]; 95 | [path addLineToPoint :( CGPoint ) { CGRectGetWidth(label.frame), 0}]; 96 | [path addLineToPoint :( CGPoint ) { angleWidth, 0}]; 97 | break; 98 | } 99 | // 100 | CAShapeLayer* mask = [CAShapeLayer layer]; 101 | mask.path = path.CGPath ; 102 | label.layer.mask = mask; 103 | } 104 | 105 | - (void)creatCircleView 106 | { //circleLayer 107 | CGSize circleSize = _circleSize; 108 | _circleLayer =[CALayer new]; 109 | _circleLayer.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7].CGColor; 110 | _circleLayer.position = CGPointMake(circleSize.width/2, circleSize.height/2); 111 | _circleLayer.bounds = CGRectMake(0, 0, circleSize.width, circleSize.height); 112 | _circleLayer.cornerRadius = circleSize.width/2; 113 | [self.layer addSublayer:_circleLayer]; 114 | //circleView 115 | _circleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, circleSize.width, circleSize.height)]; 116 | _circleView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.8]; 117 | _circleView.layer.cornerRadius = _circleView.frame.size.width / 2; 118 | _circleView.layer.masksToBounds = YES; 119 | [self addSubview:_circleView]; 120 | // 121 | _circleView.center = CGPointMake(10, CGRectGetHeight(self.frame)/2.0); 122 | _circleLayer.position = _circleView.center; 123 | 124 | [self circleAnimation:_circleLayer]; 125 | } 126 | 127 | 128 | - (void)circleAnimation:(CALayer *)layer 129 | { 130 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; 131 | animationGroup.repeatCount = HUGE_VALF; 132 | [animationGroup setDuration:1]; 133 | CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 134 | animationGroup.timingFunction = timingFunction; 135 | 136 | CABasicAnimation *fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 137 | fadeAnimation.fromValue = [NSNumber numberWithFloat:0.5]; 138 | fadeAnimation.toValue = [NSNumber numberWithFloat:0]; 139 | 140 | CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 141 | scaleAnimation.fromValue = [NSNumber numberWithFloat:1]; 142 | scaleAnimation.toValue = [NSNumber numberWithFloat:5]; 143 | animationGroup.animations = [NSArray arrayWithObjects:fadeAnimation, scaleAnimation, nil]; 144 | [layer addAnimation:animationGroup forKey:@"fadeAnimation"]; 145 | } 146 | 147 | - (void)setText:(NSString *)text 148 | { 149 | _text = text; 150 | _textLabel.text = _text; 151 | [_textLabel sizeToFit]; 152 | //textLabel.frame 153 | CGRect rect = _textLabel.frame; 154 | rect.size.height += 10; 155 | rect.size.width += 30; 156 | _textLabel.frame = rect; 157 | [self triangle:_textLabel]; 158 | [self handelFrameWithRect:rect]; 159 | } 160 | 161 | //change frame 162 | - (void)handelFrameWithRect:(CGRect)rect 163 | { 164 | //self.frame 165 | self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, rect.size.width + 4 *_circleSize.width, rect.size.height); 166 | switch (self.direction) { 167 | case LBTagDirectionLeft: 168 | _circleView.center = ( CGPoint ) { 5 *_circleSize.width/2.0 , self.frame.size.height/2.0 }; 169 | _circleLayer.position = _circleView.center; 170 | _textLabel.frame = CGRectMake(4 *_circleSize.width, 0, CGRectGetWidth(_textLabel.frame), CGRectGetHeight(_textLabel.frame)); 171 | break; 172 | case LBTagDirectionRight: 173 | _textLabel.frame = CGRectMake(0, 0, CGRectGetWidth(_textLabel.frame), CGRectGetHeight(_textLabel.frame)); 174 | _circleView.center = ( CGPoint ) { CGRectGetWidth(_textLabel.frame) + 3 *_circleSize.width/2.0 , self.frame.size.height/2.0 }; 175 | _circleLayer.position = _circleView.center; 176 | break; 177 | } 178 | 179 | } 180 | 181 | - (void)setTextColor:(UIColor *)textColor 182 | { 183 | _textColor = textColor; 184 | _textLabel.textColor = textColor; 185 | } 186 | 187 | - (void)setFont:(UIFont *)font 188 | { 189 | _textLabel.font = font; 190 | [self setText:_textLabel.text]; 191 | } 192 | 193 | - (void)setBackgroundColor:(UIColor *)backgroundColor 194 | { 195 | _backgroundColor = backgroundColor; 196 | _textLabel.backgroundColor = backgroundColor; 197 | } 198 | 199 | - (void)setCirclrColor:(UIColor *)circlrColor 200 | { 201 | _circlrColor = circlrColor; 202 | _circleView.backgroundColor = circlrColor; 203 | } 204 | 205 | - (void)setCirclrShadowColor:(UIColor *)circlrShadowColor 206 | { 207 | _circlrShadowColor = circlrShadowColor; 208 | _circleLayer.backgroundColor = circlrShadowColor.CGColor; 209 | } 210 | 211 | - (void)setTapGestureRecognizer:(UITapGestureRecognizer *)tapGesture 212 | { 213 | if ([tapGesture isKindOfClass:[UITapGestureRecognizer class]]) { 214 | _tapGestureRecognizer = tapGesture; 215 | [self addGestureRecognizer:tapGesture]; 216 | } 217 | } 218 | 219 | #pragma mark ----touch event 220 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 221 | { 222 | if (!_canMove || touches.count > 1) { 223 | return; 224 | } 225 | UITouch *touch = [touches anyObject]; 226 | UIView *superView = self.superview; 227 | lastPoint = [touch locationInView:superView]; 228 | } 229 | 230 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 231 | { 232 | if (!_canMove || touches.count > 1) { 233 | return; 234 | } 235 | UITouch *touch = [touches anyObject]; 236 | CGPoint point = [touch locationInView:self.superview]; 237 | self.center = CGPointMake(self.center.x + point.x - lastPoint.x, self.center.y + point.y - lastPoint.y); 238 | lastPoint = point; 239 | } 240 | 241 | - (void)setDirection:(LBTagDirection)direction 242 | { 243 | _direction = direction; 244 | [self triangle:_textLabel]; 245 | [self handelFrameWithRect:_textLabel.frame]; 246 | 247 | } 248 | 249 | @end 250 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LBTagView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LBTagView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LBTagView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) NSMutableArray *tags; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | self.view.backgroundColor = [UIColor lightGrayColor]; 23 | // Do any additional setup after loading the view, typically from a nib. 24 | _tags = @[].mutableCopy; 25 | NSArray *array = @[@"hello,I am a tagView,I can't be moved!", 26 | @"hello,I am bigger tagView", 27 | @"Tap me to change my appearance", 28 | @"hello,I am a default tagView"]; 29 | 30 | [array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 31 | // 32 | LBTagView *tagView = [[LBTagView alloc] initWithFrame:CGRectMake(20, 20 + 70 * idx, 0, 0)]; 33 | tagView.text = obj; 34 | [self.view addSubview:tagView]; 35 | [_tags addObject:tagView]; 36 | }]; 37 | //one 38 | LBTagView *tagView1 = _tags[0]; 39 | tagView1.backgroundColor = [UIColor orangeColor]; 40 | tagView1.direction = LBTagDirectionRight; 41 | tagView1.canMove = NO; 42 | //two 43 | LBTagView *tagView2 = _tags[1]; 44 | tagView2.direction = LBTagDirectionLeft; 45 | tagView2.font = [UIFont systemFontOfSize:16]; 46 | tagView2.backgroundColor = [UIColor purpleColor]; 47 | tagView2.circlrColor = [UIColor orangeColor]; 48 | tagView2.circlrShadowColor = [UIColor blackColor]; 49 | //three 50 | LBTagView *tagView3 = _tags[2]; 51 | tagView3.direction = LBTagDirectionRight; 52 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(changeTagViewStyle:)]; 53 | tagView3.tapGestureRecognizer = tap; 54 | 55 | } 56 | 57 | - (void)didReceiveMemoryWarning { 58 | [super didReceiveMemoryWarning]; 59 | // Dispose of any resources that can be recreated. 60 | } 61 | 62 | - (void)changeTagViewStyle:(UITapGestureRecognizer *)tap 63 | { 64 | LBTagView *tag = (LBTagView *)tap.view; 65 | UIColor *color = [UIColor colorWithRed:(arc4random()%255)/255.0 green:(arc4random()%255)/255.0 blue:(arc4random()%255)/255.0 alpha:0.7]; 66 | tag.backgroundColor = color; 67 | tag.circlrColor = color; 68 | tag.circlrShadowColor = color; 69 | tag.backgroundColor = color; 70 | // 71 | static int key = 0; 72 | key == 0 ? (tag.direction = LBTagDirectionLeft,key++) : (tag.direction = LBTagDirectionRight,key--) 73 | ; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /LBTagView/LBTagView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LBTagView 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LBTagView/LBTagViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LBTagView/LBTagViewTests/LBTagViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBTagViewTests.m 3 | // LBTagViewTests 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LBTagViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LBTagViewTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LBTagView/LBTagViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LBTagView/LBTagViewUITests/LBTagViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBTagViewUITests.m 3 | // LBTagViewUITests 4 | // 5 | // Created by luobbe on 16/1/12. 6 | // Copyright © 2016年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LBTagViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LBTagViewUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 luobbe 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LBTagView 2 | 3 | ![gif][image-1] 4 | 5 | ### What 6 | 7 | LBTagView is useful to add tag to image or other views. It is intelligent, you can drag where you want.It’s easy to use with simple API.You can set its colors and font what you like. 8 | 9 | ### Requirements 10 | 11 | iOS 7 and later ARC 12 | 13 | ### Usage 14 | 15 | It is easy to use. You just need to creat a tagView ,set its text and add view you want,that’s all. 16 | 17 | LBTagView *tag = [[LBTagView alloc] initWithFrame:CGRectMake(50, 300, 100, 100)]; 18 | tag.text = @"hello world"; 19 | [self.view addSubview:tag]; 20 | 21 | #### Customization 22 | 23 | // is can be moved 24 | @property (nonatomic, assign) BOOL canMove; 25 | 26 | // text 27 | @property (nonatomic, copy) NSString *text; 28 | 29 | // default [UIColor whiteColor] 30 | @property (nonatomic, strong) UIColor *textColor; 31 | 32 | // default is LBTagDirectionLeft 33 | @property (nonatomic, assign) LBTagDirection direction; 34 | 35 | // default [UIFont systemFontOfSize:12] 36 | @property (nonatomic, strong) UIFont *font; 37 | 38 | // default [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5] 39 | @property (nonatomic, strong) UIColor *backgroundColor; 40 | 41 | // default [UIColor colorWithRed:1 green:1 blue:1 alpha:0.8] 42 | @property (nonatomic, strong) UIColor *circlrColor; 43 | 44 | // default [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7] 45 | @property (nonatomic, strong) UIColor *circlrShadowColor; 46 | 47 | // tap action 48 | @property (nonatomic, strong) UITapGestureRecognizer *tapGestureRecognizer; 49 | 50 | ### Example 51 | 52 | For more information, you can download the zip and run the example. 53 | 54 | ### License 55 | 56 | LBTagView is available under the MIT license. See the LICENSE file for more info. 57 | 58 | [image-1]: http://ww3.sinaimg.cn/large/9f1201f5gw1f069256ryjg209y0ddtvd.gif 59 | 60 | --------------------------------------------------------------------------------