├── IconLabel ├── IconLabel.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── chaojiwandianshang.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── chaojiwandianshang.xcuserdatad │ │ └── xcschemes │ │ ├── IconLabel.xcscheme │ │ └── xcschememanagement.plist └── IconLabel │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── IconLabel │ ├── AttributedUtils.h │ └── AttributedUtils.m │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── README.md └── icon.png /IconLabel/IconLabel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 555246BA1FCCF54200242DC1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 555246B91FCCF54200242DC1 /* main.m */; }; 11 | 555246BD1FCCF54200242DC1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 555246BC1FCCF54200242DC1 /* AppDelegate.m */; }; 12 | 555246C01FCCF54200242DC1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 555246BF1FCCF54200242DC1 /* ViewController.m */; }; 13 | 555246C31FCCF54200242DC1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 555246C11FCCF54200242DC1 /* Main.storyboard */; }; 14 | 555246C51FCCF54200242DC1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 555246C41FCCF54200242DC1 /* Assets.xcassets */; }; 15 | 555246C81FCCF54200242DC1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 555246C61FCCF54200242DC1 /* LaunchScreen.storyboard */; }; 16 | 555246D51FCCF6EB00242DC1 /* AttributedUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 555246D41FCCF6EB00242DC1 /* AttributedUtils.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 555246B51FCCF54200242DC1 /* IconLabel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IconLabel.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 555246B91FCCF54200242DC1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | 555246BB1FCCF54200242DC1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | 555246BC1FCCF54200242DC1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | 555246BE1FCCF54200242DC1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | 555246BF1FCCF54200242DC1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | 555246C21FCCF54200242DC1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 555246C41FCCF54200242DC1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 555246C71FCCF54200242DC1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 555246C91FCCF54200242DC1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 555246D31FCCF6EB00242DC1 /* AttributedUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttributedUtils.h; sourceTree = ""; }; 31 | 555246D41FCCF6EB00242DC1 /* AttributedUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttributedUtils.m; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 555246B21FCCF54200242DC1 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 555246AC1FCCF54200242DC1 = { 46 | isa = PBXGroup; 47 | children = ( 48 | 555246B71FCCF54200242DC1 /* IconLabel */, 49 | 555246B61FCCF54200242DC1 /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | 555246B61FCCF54200242DC1 /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 555246B51FCCF54200242DC1 /* IconLabel.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | 555246B71FCCF54200242DC1 /* IconLabel */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 555246CF1FCCF55E00242DC1 /* IconLabel */, 65 | 555246BB1FCCF54200242DC1 /* AppDelegate.h */, 66 | 555246BC1FCCF54200242DC1 /* AppDelegate.m */, 67 | 555246BE1FCCF54200242DC1 /* ViewController.h */, 68 | 555246BF1FCCF54200242DC1 /* ViewController.m */, 69 | 555246C11FCCF54200242DC1 /* Main.storyboard */, 70 | 555246C41FCCF54200242DC1 /* Assets.xcassets */, 71 | 555246C61FCCF54200242DC1 /* LaunchScreen.storyboard */, 72 | 555246C91FCCF54200242DC1 /* Info.plist */, 73 | 555246B81FCCF54200242DC1 /* Supporting Files */, 74 | ); 75 | path = IconLabel; 76 | sourceTree = ""; 77 | }; 78 | 555246B81FCCF54200242DC1 /* Supporting Files */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 555246B91FCCF54200242DC1 /* main.m */, 82 | ); 83 | name = "Supporting Files"; 84 | sourceTree = ""; 85 | }; 86 | 555246CF1FCCF55E00242DC1 /* IconLabel */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 555246D31FCCF6EB00242DC1 /* AttributedUtils.h */, 90 | 555246D41FCCF6EB00242DC1 /* AttributedUtils.m */, 91 | ); 92 | path = IconLabel; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | 555246B41FCCF54200242DC1 /* IconLabel */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = 555246CC1FCCF54200242DC1 /* Build configuration list for PBXNativeTarget "IconLabel" */; 101 | buildPhases = ( 102 | 555246B11FCCF54200242DC1 /* Sources */, 103 | 555246B21FCCF54200242DC1 /* Frameworks */, 104 | 555246B31FCCF54200242DC1 /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = IconLabel; 111 | productName = IconLabel; 112 | productReference = 555246B51FCCF54200242DC1 /* IconLabel.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | 555246AD1FCCF54200242DC1 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastUpgradeCheck = 0830; 122 | ORGANIZATIONNAME = "超级腕电商"; 123 | TargetAttributes = { 124 | 555246B41FCCF54200242DC1 = { 125 | CreatedOnToolsVersion = 8.3.3; 126 | DevelopmentTeam = QS43CC5A87; 127 | ProvisioningStyle = Automatic; 128 | }; 129 | }; 130 | }; 131 | buildConfigurationList = 555246B01FCCF54200242DC1 /* Build configuration list for PBXProject "IconLabel" */; 132 | compatibilityVersion = "Xcode 3.2"; 133 | developmentRegion = English; 134 | hasScannedForEncodings = 0; 135 | knownRegions = ( 136 | en, 137 | Base, 138 | ); 139 | mainGroup = 555246AC1FCCF54200242DC1; 140 | productRefGroup = 555246B61FCCF54200242DC1 /* Products */; 141 | projectDirPath = ""; 142 | projectRoot = ""; 143 | targets = ( 144 | 555246B41FCCF54200242DC1 /* IconLabel */, 145 | ); 146 | }; 147 | /* End PBXProject section */ 148 | 149 | /* Begin PBXResourcesBuildPhase section */ 150 | 555246B31FCCF54200242DC1 /* Resources */ = { 151 | isa = PBXResourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 555246C81FCCF54200242DC1 /* LaunchScreen.storyboard in Resources */, 155 | 555246C51FCCF54200242DC1 /* Assets.xcassets in Resources */, 156 | 555246C31FCCF54200242DC1 /* Main.storyboard in Resources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXResourcesBuildPhase section */ 161 | 162 | /* Begin PBXSourcesBuildPhase section */ 163 | 555246B11FCCF54200242DC1 /* Sources */ = { 164 | isa = PBXSourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 555246C01FCCF54200242DC1 /* ViewController.m in Sources */, 168 | 555246D51FCCF6EB00242DC1 /* AttributedUtils.m in Sources */, 169 | 555246BD1FCCF54200242DC1 /* AppDelegate.m in Sources */, 170 | 555246BA1FCCF54200242DC1 /* main.m in Sources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXSourcesBuildPhase section */ 175 | 176 | /* Begin PBXVariantGroup section */ 177 | 555246C11FCCF54200242DC1 /* Main.storyboard */ = { 178 | isa = PBXVariantGroup; 179 | children = ( 180 | 555246C21FCCF54200242DC1 /* Base */, 181 | ); 182 | name = Main.storyboard; 183 | sourceTree = ""; 184 | }; 185 | 555246C61FCCF54200242DC1 /* LaunchScreen.storyboard */ = { 186 | isa = PBXVariantGroup; 187 | children = ( 188 | 555246C71FCCF54200242DC1 /* Base */, 189 | ); 190 | name = LaunchScreen.storyboard; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXVariantGroup section */ 194 | 195 | /* Begin XCBuildConfiguration section */ 196 | 555246CA1FCCF54200242DC1 /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ANALYZER_NONNULL = YES; 201 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 203 | CLANG_CXX_LIBRARY = "libc++"; 204 | CLANG_ENABLE_MODULES = YES; 205 | CLANG_ENABLE_OBJC_ARC = YES; 206 | CLANG_WARN_BOOL_CONVERSION = YES; 207 | CLANG_WARN_CONSTANT_CONVERSION = YES; 208 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 209 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 210 | CLANG_WARN_EMPTY_BODY = YES; 211 | CLANG_WARN_ENUM_CONVERSION = YES; 212 | CLANG_WARN_INFINITE_RECURSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 216 | CLANG_WARN_UNREACHABLE_CODE = YES; 217 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 218 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 219 | COPY_PHASE_STRIP = NO; 220 | DEBUG_INFORMATION_FORMAT = dwarf; 221 | ENABLE_STRICT_OBJC_MSGSEND = YES; 222 | ENABLE_TESTABILITY = YES; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_NO_COMMON_BLOCKS = YES; 226 | GCC_OPTIMIZATION_LEVEL = 0; 227 | GCC_PREPROCESSOR_DEFINITIONS = ( 228 | "DEBUG=1", 229 | "$(inherited)", 230 | ); 231 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 232 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 233 | GCC_WARN_UNDECLARED_SELECTOR = YES; 234 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 235 | GCC_WARN_UNUSED_FUNCTION = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 238 | MTL_ENABLE_DEBUG_INFO = YES; 239 | ONLY_ACTIVE_ARCH = YES; 240 | SDKROOT = iphoneos; 241 | }; 242 | name = Debug; 243 | }; 244 | 555246CB1FCCF54200242DC1 /* Release */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_ANALYZER_NONNULL = YES; 249 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_WARN_BOOL_CONVERSION = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNREACHABLE_CODE = YES; 265 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 266 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 267 | COPY_PHASE_STRIP = NO; 268 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 269 | ENABLE_NS_ASSERTIONS = NO; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu99; 272 | GCC_NO_COMMON_BLOCKS = YES; 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 280 | MTL_ENABLE_DEBUG_INFO = NO; 281 | SDKROOT = iphoneos; 282 | VALIDATE_PRODUCT = YES; 283 | }; 284 | name = Release; 285 | }; 286 | 555246CD1FCCF54200242DC1 /* Debug */ = { 287 | isa = XCBuildConfiguration; 288 | buildSettings = { 289 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 290 | DEVELOPMENT_TEAM = QS43CC5A87; 291 | INFOPLIST_FILE = IconLabel/Info.plist; 292 | IPHONEOS_DEPLOYMENT_TARGET = 8; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = model.IconLabel; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | }; 297 | name = Debug; 298 | }; 299 | 555246CE1FCCF54200242DC1 /* Release */ = { 300 | isa = XCBuildConfiguration; 301 | buildSettings = { 302 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 303 | DEVELOPMENT_TEAM = QS43CC5A87; 304 | INFOPLIST_FILE = IconLabel/Info.plist; 305 | IPHONEOS_DEPLOYMENT_TARGET = 8; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | PRODUCT_BUNDLE_IDENTIFIER = model.IconLabel; 308 | PRODUCT_NAME = "$(TARGET_NAME)"; 309 | }; 310 | name = Release; 311 | }; 312 | /* End XCBuildConfiguration section */ 313 | 314 | /* Begin XCConfigurationList section */ 315 | 555246B01FCCF54200242DC1 /* Build configuration list for PBXProject "IconLabel" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | 555246CA1FCCF54200242DC1 /* Debug */, 319 | 555246CB1FCCF54200242DC1 /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | 555246CC1FCCF54200242DC1 /* Build configuration list for PBXNativeTarget "IconLabel" */ = { 325 | isa = XCConfigurationList; 326 | buildConfigurations = ( 327 | 555246CD1FCCF54200242DC1 /* Debug */, 328 | 555246CE1FCCF54200242DC1 /* Release */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | }; 332 | /* End XCConfigurationList section */ 333 | }; 334 | rootObject = 555246AD1FCCF54200242DC1 /* Project object */; 335 | } 336 | -------------------------------------------------------------------------------- /IconLabel/IconLabel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /IconLabel/IconLabel.xcodeproj/project.xcworkspace/xcuserdata/chaojiwandianshang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SionChen/IconAttributed/0ba37b73b3f836503f9f54980c99ae05e0f1f51d/IconLabel/IconLabel.xcodeproj/project.xcworkspace/xcuserdata/chaojiwandianshang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /IconLabel/IconLabel.xcodeproj/xcuserdata/chaojiwandianshang.xcuserdatad/xcschemes/IconLabel.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /IconLabel/IconLabel.xcodeproj/xcuserdata/chaojiwandianshang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | IconLabel.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 555246B41FCCF54200242DC1 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. 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 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. 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 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 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 invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 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 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 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 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/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 | } -------------------------------------------------------------------------------- /IconLabel/IconLabel/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 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/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 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/IconLabel/AttributedUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // AttributedUtils.h 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AttributedUtils : NSObject 12 | + (instancetype)sharedClient; 13 | -(NSMutableAttributedString *)titleAttributedStringWithText:(NSString *)text andIconText:(NSString *)signText; 14 | @end 15 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/IconLabel/AttributedUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // AttributedUtils.m 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. All rights reserved. 7 | // 8 | 9 | #import "AttributedUtils.h" 10 | #import 11 | //#define isSimulator [[UIDevice currentDevice].model rangeOfString:@"Simulator"].location != NSNotFound 12 | @interface AttributedUtils() 13 | @property (nonatomic,strong) UILabel *applyLabel;//这里持有是为了layer渲染优化 14 | @end 15 | @implementation AttributedUtils 16 | 17 | + (instancetype)sharedClient { 18 | static AttributedUtils *_sharedClient = nil; 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | _sharedClient = [[AttributedUtils alloc] init]; 22 | }); 23 | return _sharedClient; 24 | } 25 | 26 | #pragma mark Method 27 | 28 | /** 29 | 带有标签的富文本字符串 30 | 31 | @param text text 32 | @param signText icontext 33 | @return - 34 | */ 35 | -(NSMutableAttributedString *)titleAttributedStringWithText:(NSString *)text andIconText:(NSString *)signText{ 36 | NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@", text]]; 37 | //NSTextAttachment可以将要插入的图片作为特殊字符处理 38 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; 39 | //定义图片内容及位置和大小 40 | UIImage * signImage = [self iconWithText:signText]; 41 | attch.image = signImage; 42 | attch.bounds = CGRectMake(0, 0, signImage.size.width, signImage.size.height); 43 | //创建带有图片的富文本 44 | NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attch]; 45 | //将图片放在最后一位 46 | //[attri appendAttributedString:string]; 47 | //将图片放在第一位 48 | [attri insertAttributedString:string atIndex:0]; 49 | [attri addAttribute:NSBaselineOffsetAttributeName value:@(-3) range:NSMakeRange(0, 1)]; 50 | return attri; 51 | } 52 | 53 | /** 54 | 文本转图片 55 | 56 | @param text - 57 | @return - 58 | */ 59 | -(UIImage *)iconWithText:(NSString *)text{ 60 | 61 | CGSize size = [text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]}]; 62 | self.applyLabel.frame = CGRectMake(0, 0, size.width+8, 16); 63 | self.applyLabel.text = text; 64 | return [self imageWithUIView:self.applyLabel]; 65 | } 66 | /** 67 | view装image 68 | 69 | @param view view 70 | @return image 71 | */ 72 | - (UIImage*) imageWithUIView:(UIView*) view 73 | { 74 | 75 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(TARGET_IPHONE_SIMULATOR?view.bounds.size.width:view.bounds.size.width-1, view.bounds.size.height),YES, [UIScreen mainScreen].scale); 76 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 77 | CGContextSetStrokeColorWithColor(ctx, [UIColor whiteColor].CGColor); 78 | CGContextSetFillColorWithColor(ctx, [UIColor whiteColor].CGColor); 79 | CGContextSetBlendMode(ctx, kCGBlendModeNormal); 80 | CGContextFillRect(ctx, view.bounds); 81 | [view.layer renderInContext:ctx]; 82 | UIImage* tImage = UIGraphicsGetImageFromCurrentImageContext(); 83 | UIGraphicsEndImageContext(); 84 | return tImage; 85 | } 86 | #pragma mark ---G 87 | -(UILabel*)applyLabel{ 88 | if(!_applyLabel){ 89 | _applyLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 90 | _applyLabel.backgroundColor = [UIColor redColor]; 91 | _applyLabel.textColor = [UIColor whiteColor]; 92 | //_applyLabel.text = text; 93 | _applyLabel.layer.masksToBounds = YES; 94 | _applyLabel.layer.cornerRadius = 3; 95 | _applyLabel.layer.shouldRasterize = YES; 96 | _applyLabel.textAlignment = NSTextAlignmentCenter; 97 | _applyLabel.font = [UIFont systemFontOfSize:12]; 98 | } 99 | return _applyLabel; 100 | } 101 | @end 102 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "AttributedUtils.h" 11 | #import 12 | 13 | @interface ViewController () 14 | @property (nonatomic,strong) UILabel *textLabel; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | self.textLabel.frame = CGRectMake(100, 100, 200, 200); 23 | [self.view addSubview:self.textLabel]; 24 | self.textLabel.attributedText = [[AttributedUtils sharedClient] titleAttributedStringWithText:@"文本字段文本字段文本字段文本字段文本字段文本字段文本字段" andIconText:@"京东自营"]; 25 | } 26 | 27 | #pragma mark ---G 28 | -(UILabel*)textLabel{ 29 | if(!_textLabel){ 30 | _textLabel = [[UILabel alloc] init]; 31 | _textLabel.textColor = [UIColor blackColor]; 32 | _textLabel.font = [UIFont systemFontOfSize:14]; 33 | _textLabel.numberOfLines = 2; 34 | _textLabel.userInteractionEnabled = YES; 35 | } 36 | return _textLabel; 37 | } 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /IconLabel/IconLabel/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // IconLabel 4 | // 5 | // Created by 超级腕电商 on 2017/11/28. 6 | // Copyright © 2017年 超级腕电商. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IconAttributed 2 | 仿京东、天猫商品标签 icon 3 | ![img](https://github.com/SionChen/IconAttributed/blob/master/icon.png) 4 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SionChen/IconAttributed/0ba37b73b3f836503f9f54980c99ae05e0f1f51d/icon.png --------------------------------------------------------------------------------