├── README.md ├── STHudTextDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── StriEver.xcuserdatad │ └── xcschemes │ ├── STHudTextDemo.xcscheme │ └── xcschememanagement.plist └── STHudTextDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist ├── STTextHud ├── GCLoadingView.h ├── GCLoadingView.m ├── NSString+Size.h ├── NSString+Size.m ├── STError@2x.png ├── STSuccess@2x.png ├── STTextHud.h ├── STTextHud.m ├── STTextHud.xib ├── STTextHudTool.h ├── STTextHudTool.m └── angle-mask@3x.png ├── ViewController.h ├── ViewController.m ├── main.m └── 截图 ├── 0.png ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png └── 7.png /README.md: -------------------------------------------------------------------------------- 1 | # STTTextHud 2 | #####目录 3 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/2.png) 4 | #####未设置延迟提示 5 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/6.png) 6 | #####自己设置延迟提示 7 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/7.png) 8 | #####自己失败提示 9 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/4.png) 10 | #####成功提示 11 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/5.png) 12 | #####数据请求等待 13 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/3.png) 14 | #####带标题数据请求等待 15 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/1.png) 16 | #####菊花等待框 17 | ![image](https://github.com/strivever/STTTextHud/blob/master/STHudTextDemo/截图/0.png) 18 | -------------------------------------------------------------------------------- /STHudTextDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D3165CE61CE6FB2B0041391C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165CE51CE6FB2B0041391C /* main.m */; }; 11 | D3165CE91CE6FB2B0041391C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165CE81CE6FB2B0041391C /* AppDelegate.m */; }; 12 | D3165CEC1CE6FB2B0041391C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165CEB1CE6FB2B0041391C /* ViewController.m */; }; 13 | D3165CEF1CE6FB2B0041391C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3165CED1CE6FB2B0041391C /* Main.storyboard */; }; 14 | D3165CF11CE6FB2C0041391C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D3165CF01CE6FB2C0041391C /* Assets.xcassets */; }; 15 | D3165CF41CE6FB2C0041391C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3165CF21CE6FB2C0041391C /* LaunchScreen.storyboard */; }; 16 | D3165D011CE6FB870041391C /* STTextHud.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165CFD1CE6FB870041391C /* STTextHud.m */; }; 17 | D3165D021CE6FB870041391C /* STTextHud.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3165CFE1CE6FB870041391C /* STTextHud.xib */; }; 18 | D3165D031CE6FB870041391C /* STTextHudTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165D001CE6FB870041391C /* STTextHudTool.m */; }; 19 | D3165D061CE6FBEE0041391C /* GCLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165D051CE6FBEE0041391C /* GCLoadingView.m */; }; 20 | D3165D091CE6FC450041391C /* NSString+Size.m in Sources */ = {isa = PBXBuildFile; fileRef = D3165D081CE6FC450041391C /* NSString+Size.m */; }; 21 | D3165D0C1CE702E00041391C /* STError@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D3165D0A1CE702E00041391C /* STError@2x.png */; }; 22 | D3165D0D1CE702E00041391C /* STSuccess@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D3165D0B1CE702E00041391C /* STSuccess@2x.png */; }; 23 | D3165D0F1CE703BD0041391C /* angle-mask@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = D3165D0E1CE703BD0041391C /* angle-mask@3x.png */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | D3165CE11CE6FB2A0041391C /* STHudTextDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = STHudTextDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | D3165CE51CE6FB2B0041391C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | D3165CE71CE6FB2B0041391C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 30 | D3165CE81CE6FB2B0041391C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 31 | D3165CEA1CE6FB2B0041391C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | D3165CEB1CE6FB2B0041391C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | D3165CEE1CE6FB2B0041391C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | D3165CF01CE6FB2C0041391C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | D3165CF31CE6FB2C0041391C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 36 | D3165CF51CE6FB2C0041391C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | D3165CFC1CE6FB870041391C /* STTextHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STTextHud.h; sourceTree = ""; }; 38 | D3165CFD1CE6FB870041391C /* STTextHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STTextHud.m; sourceTree = ""; }; 39 | D3165CFE1CE6FB870041391C /* STTextHud.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = STTextHud.xib; sourceTree = ""; }; 40 | D3165CFF1CE6FB870041391C /* STTextHudTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STTextHudTool.h; sourceTree = ""; }; 41 | D3165D001CE6FB870041391C /* STTextHudTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STTextHudTool.m; sourceTree = ""; }; 42 | D3165D041CE6FBEE0041391C /* GCLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCLoadingView.h; sourceTree = ""; }; 43 | D3165D051CE6FBEE0041391C /* GCLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCLoadingView.m; sourceTree = ""; }; 44 | D3165D071CE6FC450041391C /* NSString+Size.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Size.h"; sourceTree = ""; }; 45 | D3165D081CE6FC450041391C /* NSString+Size.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Size.m"; sourceTree = ""; }; 46 | D3165D0A1CE702E00041391C /* STError@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "STError@2x.png"; sourceTree = ""; }; 47 | D3165D0B1CE702E00041391C /* STSuccess@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "STSuccess@2x.png"; sourceTree = ""; }; 48 | D3165D0E1CE703BD0041391C /* angle-mask@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "angle-mask@3x.png"; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | D3165CDE1CE6FB2A0041391C /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | D3165CD81CE6FB2A0041391C = { 63 | isa = PBXGroup; 64 | children = ( 65 | D3165CE31CE6FB2B0041391C /* STHudTextDemo */, 66 | D3165CE21CE6FB2A0041391C /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | D3165CE21CE6FB2A0041391C /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | D3165CE11CE6FB2A0041391C /* STHudTextDemo.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | D3165CE31CE6FB2B0041391C /* STHudTextDemo */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | D3165CFB1CE6FB760041391C /* STTextHud */, 82 | D3165CE71CE6FB2B0041391C /* AppDelegate.h */, 83 | D3165CE81CE6FB2B0041391C /* AppDelegate.m */, 84 | D3165CEA1CE6FB2B0041391C /* ViewController.h */, 85 | D3165CEB1CE6FB2B0041391C /* ViewController.m */, 86 | D3165CED1CE6FB2B0041391C /* Main.storyboard */, 87 | D3165CF01CE6FB2C0041391C /* Assets.xcassets */, 88 | D3165CF21CE6FB2C0041391C /* LaunchScreen.storyboard */, 89 | D3165CF51CE6FB2C0041391C /* Info.plist */, 90 | D3165CE41CE6FB2B0041391C /* Supporting Files */, 91 | ); 92 | path = STHudTextDemo; 93 | sourceTree = ""; 94 | }; 95 | D3165CE41CE6FB2B0041391C /* Supporting Files */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | D3165CE51CE6FB2B0041391C /* main.m */, 99 | ); 100 | name = "Supporting Files"; 101 | sourceTree = ""; 102 | }; 103 | D3165CFB1CE6FB760041391C /* STTextHud */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | D3165D0E1CE703BD0041391C /* angle-mask@3x.png */, 107 | D3165D0A1CE702E00041391C /* STError@2x.png */, 108 | D3165D0B1CE702E00041391C /* STSuccess@2x.png */, 109 | D3165D071CE6FC450041391C /* NSString+Size.h */, 110 | D3165D081CE6FC450041391C /* NSString+Size.m */, 111 | D3165D041CE6FBEE0041391C /* GCLoadingView.h */, 112 | D3165D051CE6FBEE0041391C /* GCLoadingView.m */, 113 | D3165CFC1CE6FB870041391C /* STTextHud.h */, 114 | D3165CFD1CE6FB870041391C /* STTextHud.m */, 115 | D3165CFE1CE6FB870041391C /* STTextHud.xib */, 116 | D3165CFF1CE6FB870041391C /* STTextHudTool.h */, 117 | D3165D001CE6FB870041391C /* STTextHudTool.m */, 118 | ); 119 | path = STTextHud; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | D3165CE01CE6FB2A0041391C /* STHudTextDemo */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = D3165CF81CE6FB2C0041391C /* Build configuration list for PBXNativeTarget "STHudTextDemo" */; 128 | buildPhases = ( 129 | D3165CDD1CE6FB2A0041391C /* Sources */, 130 | D3165CDE1CE6FB2A0041391C /* Frameworks */, 131 | D3165CDF1CE6FB2A0041391C /* Resources */, 132 | ); 133 | buildRules = ( 134 | ); 135 | dependencies = ( 136 | ); 137 | name = STHudTextDemo; 138 | productName = STHudTextDemo; 139 | productReference = D3165CE11CE6FB2A0041391C /* STHudTextDemo.app */; 140 | productType = "com.apple.product-type.application"; 141 | }; 142 | /* End PBXNativeTarget section */ 143 | 144 | /* Begin PBXProject section */ 145 | D3165CD91CE6FB2A0041391C /* Project object */ = { 146 | isa = PBXProject; 147 | attributes = { 148 | LastUpgradeCheck = 0730; 149 | ORGANIZATIONNAME = StriEver; 150 | TargetAttributes = { 151 | D3165CE01CE6FB2A0041391C = { 152 | CreatedOnToolsVersion = 7.3; 153 | DevelopmentTeam = G49DMHKN44; 154 | }; 155 | }; 156 | }; 157 | buildConfigurationList = D3165CDC1CE6FB2A0041391C /* Build configuration list for PBXProject "STHudTextDemo" */; 158 | compatibilityVersion = "Xcode 3.2"; 159 | developmentRegion = English; 160 | hasScannedForEncodings = 0; 161 | knownRegions = ( 162 | en, 163 | Base, 164 | ); 165 | mainGroup = D3165CD81CE6FB2A0041391C; 166 | productRefGroup = D3165CE21CE6FB2A0041391C /* Products */; 167 | projectDirPath = ""; 168 | projectRoot = ""; 169 | targets = ( 170 | D3165CE01CE6FB2A0041391C /* STHudTextDemo */, 171 | ); 172 | }; 173 | /* End PBXProject section */ 174 | 175 | /* Begin PBXResourcesBuildPhase section */ 176 | D3165CDF1CE6FB2A0041391C /* Resources */ = { 177 | isa = PBXResourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | D3165CF41CE6FB2C0041391C /* LaunchScreen.storyboard in Resources */, 181 | D3165D0D1CE702E00041391C /* STSuccess@2x.png in Resources */, 182 | D3165CF11CE6FB2C0041391C /* Assets.xcassets in Resources */, 183 | D3165CEF1CE6FB2B0041391C /* Main.storyboard in Resources */, 184 | D3165D021CE6FB870041391C /* STTextHud.xib in Resources */, 185 | D3165D0F1CE703BD0041391C /* angle-mask@3x.png in Resources */, 186 | D3165D0C1CE702E00041391C /* STError@2x.png in Resources */, 187 | ); 188 | runOnlyForDeploymentPostprocessing = 0; 189 | }; 190 | /* End PBXResourcesBuildPhase section */ 191 | 192 | /* Begin PBXSourcesBuildPhase section */ 193 | D3165CDD1CE6FB2A0041391C /* Sources */ = { 194 | isa = PBXSourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | D3165CEC1CE6FB2B0041391C /* ViewController.m in Sources */, 198 | D3165D031CE6FB870041391C /* STTextHudTool.m in Sources */, 199 | D3165CE91CE6FB2B0041391C /* AppDelegate.m in Sources */, 200 | D3165D061CE6FBEE0041391C /* GCLoadingView.m in Sources */, 201 | D3165D091CE6FC450041391C /* NSString+Size.m in Sources */, 202 | D3165CE61CE6FB2B0041391C /* main.m in Sources */, 203 | D3165D011CE6FB870041391C /* STTextHud.m in Sources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXSourcesBuildPhase section */ 208 | 209 | /* Begin PBXVariantGroup section */ 210 | D3165CED1CE6FB2B0041391C /* Main.storyboard */ = { 211 | isa = PBXVariantGroup; 212 | children = ( 213 | D3165CEE1CE6FB2B0041391C /* Base */, 214 | ); 215 | name = Main.storyboard; 216 | sourceTree = ""; 217 | }; 218 | D3165CF21CE6FB2C0041391C /* LaunchScreen.storyboard */ = { 219 | isa = PBXVariantGroup; 220 | children = ( 221 | D3165CF31CE6FB2C0041391C /* Base */, 222 | ); 223 | name = LaunchScreen.storyboard; 224 | sourceTree = ""; 225 | }; 226 | /* End PBXVariantGroup section */ 227 | 228 | /* Begin XCBuildConfiguration section */ 229 | D3165CF61CE6FB2C0041391C /* Debug */ = { 230 | isa = XCBuildConfiguration; 231 | buildSettings = { 232 | ALWAYS_SEARCH_USER_PATHS = NO; 233 | CLANG_ANALYZER_NONNULL = YES; 234 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 235 | CLANG_CXX_LIBRARY = "libc++"; 236 | CLANG_ENABLE_MODULES = YES; 237 | CLANG_ENABLE_OBJC_ARC = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 241 | CLANG_WARN_EMPTY_BODY = YES; 242 | CLANG_WARN_ENUM_CONVERSION = YES; 243 | CLANG_WARN_INT_CONVERSION = YES; 244 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 245 | CLANG_WARN_UNREACHABLE_CODE = YES; 246 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 247 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 248 | COPY_PHASE_STRIP = NO; 249 | DEBUG_INFORMATION_FORMAT = dwarf; 250 | ENABLE_STRICT_OBJC_MSGSEND = YES; 251 | ENABLE_TESTABILITY = YES; 252 | GCC_C_LANGUAGE_STANDARD = gnu99; 253 | GCC_DYNAMIC_NO_PIC = NO; 254 | GCC_NO_COMMON_BLOCKS = YES; 255 | GCC_OPTIMIZATION_LEVEL = 0; 256 | GCC_PREPROCESSOR_DEFINITIONS = ( 257 | "DEBUG=1", 258 | "$(inherited)", 259 | ); 260 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 261 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 262 | GCC_WARN_UNDECLARED_SELECTOR = YES; 263 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 264 | GCC_WARN_UNUSED_FUNCTION = YES; 265 | GCC_WARN_UNUSED_VARIABLE = YES; 266 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 267 | MTL_ENABLE_DEBUG_INFO = YES; 268 | ONLY_ACTIVE_ARCH = YES; 269 | SDKROOT = iphoneos; 270 | }; 271 | name = Debug; 272 | }; 273 | D3165CF71CE6FB2C0041391C /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ALWAYS_SEARCH_USER_PATHS = NO; 277 | CLANG_ANALYZER_NONNULL = YES; 278 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 279 | CLANG_CXX_LIBRARY = "libc++"; 280 | CLANG_ENABLE_MODULES = YES; 281 | CLANG_ENABLE_OBJC_ARC = YES; 282 | CLANG_WARN_BOOL_CONVERSION = YES; 283 | CLANG_WARN_CONSTANT_CONVERSION = YES; 284 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 285 | CLANG_WARN_EMPTY_BODY = YES; 286 | CLANG_WARN_ENUM_CONVERSION = YES; 287 | CLANG_WARN_INT_CONVERSION = YES; 288 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | VALIDATE_PRODUCT = YES; 308 | }; 309 | name = Release; 310 | }; 311 | D3165CF91CE6FB2C0041391C /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 315 | CODE_SIGN_IDENTITY = "iPhone Developer: ming zong (XE5EV4Y65Q)"; 316 | INFOPLIST_FILE = STHudTextDemo/Info.plist; 317 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 319 | PRODUCT_BUNDLE_IDENTIFIER = StrivEver; 320 | PRODUCT_NAME = "$(TARGET_NAME)"; 321 | PROVISIONING_PROFILE = "8a038ca3-90fe-4bcb-bc7d-308e73b4b38e"; 322 | }; 323 | name = Debug; 324 | }; 325 | D3165CFA1CE6FB2C0041391C /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 329 | CODE_SIGN_IDENTITY = "iPhone Developer: ming zong (XE5EV4Y65Q)"; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: ming zong (XE5EV4Y65Q)"; 331 | INFOPLIST_FILE = STHudTextDemo/Info.plist; 332 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 334 | PRODUCT_BUNDLE_IDENTIFIER = StrivEver; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | PROVISIONING_PROFILE = "8a038ca3-90fe-4bcb-bc7d-308e73b4b38e"; 337 | }; 338 | name = Release; 339 | }; 340 | /* End XCBuildConfiguration section */ 341 | 342 | /* Begin XCConfigurationList section */ 343 | D3165CDC1CE6FB2A0041391C /* Build configuration list for PBXProject "STHudTextDemo" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | D3165CF61CE6FB2C0041391C /* Debug */, 347 | D3165CF71CE6FB2C0041391C /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | D3165CF81CE6FB2C0041391C /* Build configuration list for PBXNativeTarget "STHudTextDemo" */ = { 353 | isa = XCConfigurationList; 354 | buildConfigurations = ( 355 | D3165CF91CE6FB2C0041391C /* Debug */, 356 | D3165CFA1CE6FB2C0041391C /* Release */, 357 | ); 358 | defaultConfigurationIsVisible = 0; 359 | }; 360 | /* End XCConfigurationList section */ 361 | }; 362 | rootObject = D3165CD91CE6FB2A0041391C /* Project object */; 363 | } 364 | -------------------------------------------------------------------------------- /STHudTextDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /STHudTextDemo.xcodeproj/xcuserdata/StriEver.xcuserdatad/xcschemes/STHudTextDemo.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 | -------------------------------------------------------------------------------- /STHudTextDemo.xcodeproj/xcuserdata/StriEver.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | STHudTextDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D3165CE01CE6FB2A0041391C 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /STHudTextDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // STHudTextDemo 4 | // 5 | // Created by StriEver on 16/5/14. 6 | // Copyright © 2016年 StriEver. 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 | -------------------------------------------------------------------------------- /STHudTextDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // STHudTextDemo 4 | // 5 | // Created by StriEver on 16/5/14. 6 | // Copyright © 2016年 StriEver. 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 | -------------------------------------------------------------------------------- /STHudTextDemo/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 | } -------------------------------------------------------------------------------- /STHudTextDemo/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 | -------------------------------------------------------------------------------- /STHudTextDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 34 | 41 | 48 | 55 | 62 | 69 | 76 | 83 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /STHudTextDemo/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 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/GCLoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCLoadingView.h 3 | // LiquoriceDoctorProject 4 | // 5 | // Created by HenryCheng on 15/12/4. 6 | // Copyright © 2015年 iMac. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCLoadingView : UIView 12 | 13 | - (void)startAnimating; 14 | - (void)stopAnimating; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/GCLoadingView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCLoadingView.m 3 | // LiquoriceDoctorProject 4 | // 5 | // Created by HenryCheng on 15/12/4. 6 | // Copyright © 2015年 iMac. All rights reserved. 7 | // 8 | 9 | #define kNotification_AppNotify @"APP_NOTIFICATION" 10 | #define kAppActiveState @"AppActiveState" 11 | #define kAppDidBecomeActive @"AppDidBecomeActive" 12 | #define kBgSize 90.0f 13 | #define kEdgeSize 0.0f 14 | #define kAnimationDuration 1.0f 15 | 16 | #import "GCLoadingView.h" 17 | 18 | @interface GCLoadingView () 19 | 20 | @property (strong, nonatomic) UIImageView *bgImageView; 21 | @property (strong, nonatomic) UIImageView *aniImageView; 22 | @property (nonatomic ,assign) BOOL isAnimating; 23 | @property (nonatomic, strong) CAShapeLayer *indefiniteAnimatedLayer; 24 | @property (nonatomic, assign) CGFloat radius; 25 | @property (nonatomic, assign) CGFloat strokeThickness; 26 | @property (nonatomic, strong) UIColor *strokeColor; 27 | 28 | @end 29 | 30 | @implementation GCLoadingView 31 | 32 | 33 | - (id)initWithFrame:(CGRect)frame { 34 | 35 | self = [super initWithFrame:frame]; 36 | if (self) { 37 | 38 | self.radius = 24.0f; 39 | self.strokeThickness = 2.0f; 40 | self.strokeColor = [UIColor whiteColor]; 41 | 42 | self.bgImageView = [[UIImageView alloc] init]; 43 | self.bgImageView.frame = CGRectMake((CGRectGetWidth(self.frame) - kBgSize)/2, (CGRectGetHeight(self.frame) - kBgSize)/2, kBgSize, kBgSize); 44 | self.bgImageView.image = nil; 45 | [self addSubview:self.bgImageView]; 46 | self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.9]; 47 | self.aniImageView = [[UIImageView alloc]initWithFrame:CGRectMake(kEdgeSize, kEdgeSize, kBgSize - 2 * kEdgeSize, kBgSize - 2 * kEdgeSize)]; 48 | [self.bgImageView addSubview:self.aniImageView]; 49 | 50 | self.isAnimating = NO; 51 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customActivityIndicatorView_appStateChanedNotification:) name:kNotification_AppNotify object:nil]; 52 | } 53 | return self; 54 | } 55 | 56 | //修改app从后台切入前台的时候动画停止的bug 57 | - (void)customActivityIndicatorView_appStateChanedNotification:(NSNotification *)notification { 58 | 59 | NSDictionary *userInfo = notification.userInfo; 60 | if ([[userInfo objectForKey:kAppActiveState] isEqualToString:kAppDidBecomeActive]) { 61 | if(self.isAnimating){ 62 | [self setIsAnimating:YES]; 63 | } 64 | } 65 | } 66 | 67 | - (void)setFrame:(CGRect)frame { 68 | 69 | [super setFrame:frame]; 70 | self.bgImageView.frame = CGRectMake((CGRectGetWidth(self.frame) - kBgSize)/2, (CGRectGetHeight(self.frame) - kBgSize)/2, kBgSize, kBgSize); 71 | } 72 | 73 | - (void)startAnimating { 74 | 75 | self.isAnimating = YES; 76 | } 77 | 78 | - (void)setIsAnimating:(BOOL)isAnimating { 79 | 80 | _isAnimating = isAnimating; 81 | if (isAnimating) { 82 | 83 | // NSMutableArray *anmationImage1 = [NSMutableArray array]; 84 | // for (int i = 0; i < 4; i ++) { 85 | // NSString *imageStr = [NSString stringWithFormat:@"loading_%d",i+1]; 86 | // [anmationImage1 addObject:[UIImage imageNamed:imageStr]]; 87 | // 88 | // } 89 | // self.aniImageView.animationImages = anmationImage1; 90 | // self.aniImageView.animationDuration = kAnimationDuration; 91 | // self.aniImageView.animationRepeatCount = GID_MAX; 92 | // [self.aniImageView startAnimating]; 93 | CALayer *layer = self.indefiniteAnimatedLayer; 94 | [self.bgImageView.layer addSublayer:layer]; 95 | layer.position = CGPointMake(CGRectGetWidth(self.bgImageView.bounds) / 2, CGRectGetHeight(self.bgImageView.bounds) / 2); 96 | 97 | } else { 98 | 99 | } 100 | self.hidden = !isAnimating; 101 | } 102 | 103 | - (void)stopAnimating { 104 | 105 | self.isAnimating = NO; 106 | [_indefiniteAnimatedLayer removeFromSuperlayer]; 107 | _indefiniteAnimatedLayer = nil; 108 | } 109 | - (CAShapeLayer*)indefiniteAnimatedLayer { 110 | if(!_indefiniteAnimatedLayer) { 111 | CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5); 112 | CGRect rect = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2); 113 | 114 | UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter 115 | radius:self.radius 116 | startAngle:(CGFloat) (M_PI*3/2) 117 | endAngle:(CGFloat) (M_PI/2+M_PI*5) 118 | clockwise:YES]; 119 | 120 | _indefiniteAnimatedLayer = [CAShapeLayer layer]; 121 | _indefiniteAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale]; 122 | _indefiniteAnimatedLayer.frame = rect; 123 | _indefiniteAnimatedLayer.fillColor = [UIColor clearColor].CGColor; 124 | _indefiniteAnimatedLayer.strokeColor = self.strokeColor.CGColor; 125 | _indefiniteAnimatedLayer.lineWidth = self.strokeThickness; 126 | _indefiniteAnimatedLayer.lineCap = kCALineCapRound; 127 | _indefiniteAnimatedLayer.lineJoin = kCALineJoinBevel; 128 | _indefiniteAnimatedLayer.path = smoothedPath.CGPath; 129 | 130 | CALayer *maskLayer = [CALayer layer]; 131 | 132 | maskLayer.contents = (__bridge id)[[UIImage imageNamed:@"angle-mask@3x"] CGImage]; 133 | maskLayer.frame = _indefiniteAnimatedLayer.bounds; 134 | _indefiniteAnimatedLayer.mask = maskLayer; 135 | 136 | NSTimeInterval animationDuration = 1; 137 | CAMediaTimingFunction *linearCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 138 | 139 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; 140 | animation.fromValue = (id) 0; 141 | animation.toValue = @(M_PI*2); 142 | animation.duration = animationDuration; 143 | animation.timingFunction = linearCurve; 144 | animation.removedOnCompletion = NO; 145 | animation.repeatCount = INFINITY; 146 | animation.fillMode = kCAFillModeForwards; 147 | animation.autoreverses = NO; 148 | [_indefiniteAnimatedLayer.mask addAnimation:animation forKey:@"rotate"]; 149 | 150 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; 151 | animationGroup.duration = animationDuration; 152 | animationGroup.repeatCount = INFINITY; 153 | animationGroup.removedOnCompletion = NO; 154 | animationGroup.timingFunction = linearCurve; 155 | 156 | CABasicAnimation *strokeStartAnimation = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; 157 | strokeStartAnimation.fromValue = @0.015; 158 | strokeStartAnimation.toValue = @0.515; 159 | 160 | CABasicAnimation *strokeEndAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 161 | strokeEndAnimation.fromValue = @0.485; 162 | strokeEndAnimation.toValue = @0.985; 163 | 164 | animationGroup.animations = @[strokeStartAnimation, strokeEndAnimation]; 165 | [_indefiniteAnimatedLayer addAnimation:animationGroup forKey:@"progress"]; 166 | 167 | } 168 | return _indefiniteAnimatedLayer; 169 | } 170 | 171 | - (void)dealloc { 172 | 173 | [[NSNotificationCenter defaultCenter] removeObserver:self name:kNotification_AppNotify object:nil]; 174 | } 175 | 176 | /* 177 | // Only override drawRect: if you perform custom drawing. 178 | // An empty implementation adversely affects performance during animation. 179 | - (void)drawRect:(CGRect)rect { 180 | // Drawing code 181 | } 182 | */ 183 | 184 | @end 185 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/NSString+Size.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Size.h 3 | // ARErp 4 | // 5 | // Created by ZRAR on 14/11/6. 6 | // Copyright (c) 2014年 ZRAR. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | @interface NSString (Size) 12 | 13 | - (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/NSString+Size.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Size.m 3 | // ARErp 4 | // 5 | // Created by ZRAR on 14/11/6. 6 | // Copyright (c) 2014年 ZRAR. All rights reserved. 7 | // 8 | 9 | #import "NSString+Size.h" 10 | 11 | @implementation NSString (Size) 12 | 13 | - (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize{ 14 | NSDictionary *attrs = @{NSFontAttributeName : font}; 15 | return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STError@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/STTextHud/STError@2x.png -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STSuccess@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/STTextHud/STSuccess@2x.png -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STTextHud.h: -------------------------------------------------------------------------------- 1 | // 2 | // STTextHud.h 3 | // LiqForDoctors 4 | // 5 | // Created by StriEver on 16/5/10. 6 | // Copyright © 2016年 iMac. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef NS_ENUM(NSInteger, STHudStyle) { 11 | STHudError, 12 | STHudSucess, 13 | STHudCustomView, 14 | STHudText, 15 | STHudWait, 16 | STHudLoadingWithTitle, 17 | STHudLoadingWithoutTitle, 18 | STHudLoadingWithCustomView, 19 | }; 20 | //设置显示优先级 21 | typedef NS_ENUM(NSInteger, ShowPriority) { 22 | Priority_Hight = 1000, 23 | Priority_Default = 750, 24 | Priority_Low = 500, 25 | }; 26 | @interface STTextHud : UIView 27 | @property (nonatomic)STHudStyle hudStyle; 28 | @property (nonatomic)ShowPriority priority; 29 | /** 30 | * 自定义View 31 | */ 32 | @property (nonatomic, strong) UIView * customView; 33 | /** 34 | * 背景是否可以点击 35 | */ 36 | @property (nonatomic, assign) BOOL backViewIsEnable; 37 | - (void)showText:(NSString *)text withSecond:(NSInteger)delay; 38 | - (void)hidStHud; 39 | @end 40 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STTextHud.m: -------------------------------------------------------------------------------- 1 | // 2 | // STTextHud.m 3 | // LiqForDoctors 4 | // 5 | // Created by StriEver on 16/5/10. 6 | // Copyright © 2016年 iMac. All rights reserved. 7 | // 8 | 9 | #import "STTextHud.h" 10 | #import "AppDelegate.h" 11 | #import "GCLoadingView.h" 12 | #import "NSString+Size.h" 13 | #define defaeltDelay 1.5 14 | //定义高度 15 | #define kUIScreenSize [UIScreen mainScreen].bounds.size 16 | #define kUIScreenWidth kUIScreenSize.width 17 | #define kUIScreenHeight kUIScreenSize.height 18 | @interface STTextHud () 19 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 20 | @property (nonatomic)NSTimeInterval delay; 21 | @property (nonatomic,strong) UIView * coverView; 22 | @property (weak, nonatomic) IBOutlet UIView *loadView; 23 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageHeightContraint; 24 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *labelTopContraint; 25 | @property (weak, nonatomic) IBOutlet UIImageView *imageV; 26 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *labelBottomContraint; 27 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageTopContraint; 28 | @property (nonatomic, strong) UIActivityIndicatorView * waitView; 29 | @property (nonatomic, strong) GCLoadingView *actIndicator; 30 | @end 31 | @implementation STTextHud 32 | - (instancetype)init{ 33 | if (self = [super init]) { 34 | self = [[NSBundle mainBundle]loadNibNamed:@"STTextHud" owner:nil options:nil][0]; 35 | self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.9]; 36 | self.priority = Priority_Default; 37 | } 38 | return self; 39 | } 40 | - (GCLoadingView *)actIndicator{ 41 | if (!_actIndicator) { 42 | _actIndicator = [[GCLoadingView alloc]initWithFrame:CGRectMake(0, 0, 90, 90)]; 43 | [self.imageV removeFromSuperview]; 44 | self.loadView.hidden = NO; 45 | if (self.hudStyle == STHudLoadingWithTitle) { 46 | self.labelTopContraint.constant = 30; 47 | self.titleLabel.numberOfLines = 1; 48 | self.bounds = CGRectMake(0, 0, 115, 125); 49 | }else if(self.hudStyle == STHudLoadingWithoutTitle){ 50 | self.titleLabel.hidden = YES; 51 | self.bounds = CGRectMake(0, 0, 90, 90); 52 | } 53 | [self.loadView addSubview:_actIndicator]; 54 | 55 | } 56 | return _actIndicator; 57 | } 58 | - (UIActivityIndicatorView *)waitView{ 59 | if (!_waitView) { 60 | _waitView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; 61 | _waitView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; 62 | [self.imageV addSubview:_waitView]; 63 | } 64 | return _waitView; 65 | } 66 | - (void)showText:(NSString *)text withSecond:(NSInteger)delay{ 67 | _coverView = [UIView new]; 68 | UIWindow * current_window = nil; 69 | 70 | NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication]windows]reverseObjectEnumerator]; 71 | for (UIWindow *window in frontToBackWindows) 72 | if (window.windowLevel == UIWindowLevelNormal) { 73 | current_window = window; 74 | break; 75 | } 76 | //默认优先级 77 | for (UIView * vv in current_window.subviews) { 78 | if ([vv isKindOfClass:[self class]]) { 79 | STTextHud * hud = (STTextHud *)vv; 80 | if (self.priority >= hud.priority ) { 81 | [hud hidStHud]; 82 | } 83 | } 84 | } 85 | _coverView.center = current_window.center; 86 | _coverView.bounds = CGRectMake(0, 0, kUIScreenWidth, kUIScreenHeight); 87 | if (!_backViewIsEnable) { 88 | [current_window addSubview:_coverView]; 89 | } 90 | [current_window addSubview:self]; 91 | 92 | UIFont * font; 93 | //默认隐藏loadingView 94 | self.loadView.hidden = YES; 95 | self.titleLabel.text = text; 96 | if (self.hudStyle == STHudText) { 97 | self.imageTopContraint.constant = 20; 98 | self.imageHeightContraint.constant = 0; 99 | self.imageV.hidden = YES; 100 | self.labelTopContraint.constant = 0; 101 | font = [UIFont systemFontOfSize:15]; 102 | CGSize textSize = [text sizeWithFont:[UIFont systemFontOfSize:15] maxSize:CGSizeMake(MAXFLOAT, 21)]; 103 | CGFloat hudWidth = textSize.width; 104 | if (hudWidth <= kUIScreenWidth - 100 - 40) { 105 | hudWidth += 41; 106 | }else{ 107 | hudWidth = kUIScreenWidth - 100; 108 | } 109 | self.center = CGPointMake(kUIScreenWidth/2.0, kUIScreenHeight/2.0); 110 | self.bounds = CGRectMake(0, 0, hudWidth, [text sizeWithFont:[UIFont systemFontOfSize:15] maxSize:CGSizeMake(hudWidth - 40, MAXFLOAT)].height + 41); 111 | }else if(self.hudStyle == STHudLoadingWithTitle || self.hudStyle ==STHudLoadingWithoutTitle){//loading 有标题 112 | self.center = CGPointMake(kUIScreenWidth/2.0, kUIScreenHeight/2.0); 113 | [self.actIndicator startAnimating]; 114 | self.titleLabel.text = text; 115 | }else if(self.hudStyle == STHudLoadingWithCustomView){ 116 | if (self.customView) { 117 | self.loadView.hidden = NO; 118 | self.imageV.hidden = YES; 119 | self.customView.frame = CGRectMake(0, 0, 90, 90); 120 | [self.loadView addSubview:self.customView]; 121 | if (text.length > 0 && text) { 122 | self.labelTopContraint.constant = 30; 123 | self.titleLabel.numberOfLines = 1; 124 | self.bounds = CGRectMake(0, 0, 115, 125); 125 | }else{ 126 | self.titleLabel.hidden = YES; 127 | self.bounds = CGRectMake(0, 0, 90, 90); 128 | } 129 | } 130 | }else{ 131 | if (self.hudStyle == STHudSucess) { 132 | self.imageV.image = [UIImage imageNamed:@"STSuccess"]; 133 | }else if (self.hudStyle == STHudError){ 134 | self.imageV.image = [UIImage imageNamed:@"STError"]; 135 | }else if (self.hudStyle == STHudWait){ 136 | [self.waitView startAnimating]; 137 | self.imageV.image = nil; 138 | } 139 | CGSize textSize = [text sizeWithFont:[UIFont systemFontOfSize:16] maxSize:CGSizeMake(MAXFLOAT, 21)]; 140 | CGFloat hudWidth = textSize.width; 141 | if (hudWidth + 40 <= 115) { 142 | hudWidth = 115; 143 | }else if(hudWidth + 40 >= kUIScreenWidth - 100 ){ 144 | hudWidth = kUIScreenWidth - 100; 145 | }else{ 146 | hudWidth += 41; 147 | } 148 | self.titleLabel.font = [UIFont systemFontOfSize:16]; 149 | font = [UIFont systemFontOfSize:16]; 150 | self.center = CGPointMake(kUIScreenWidth/2.0, kUIScreenHeight/2.0); 151 | self.bounds = CGRectMake(0, 0, hudWidth, [text sizeWithFont:font maxSize:CGSizeMake(hudWidth - 40, MAXFLOAT)].height + 101); 152 | } 153 | self.layer.masksToBounds = YES; 154 | self.layer.cornerRadius = 10; 155 | self.delay = delay; 156 | [self hideHud]; 157 | } 158 | - (void)setBackViewIsEnable:(BOOL)backViewIsEnable{ 159 | _backViewIsEnable = backViewIsEnable; 160 | if (_backViewIsEnable) { 161 | [_coverView removeFromSuperview]; 162 | } 163 | } 164 | - (void)hideHud{ 165 | if (self.delay == 0) { 166 | self.delay = defaeltDelay; 167 | } 168 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 169 | [self hidStHud]; 170 | }); 171 | } 172 | - (void)hidStHud{ 173 | if (_waitView) { 174 | [_waitView stopAnimating]; 175 | } 176 | self.hidden = YES; 177 | _coverView.hidden = YES; 178 | [_coverView removeFromSuperview]; 179 | [self removeFromSuperview]; 180 | } 181 | 182 | 183 | // 184 | ///** 185 | // * 开始动画 186 | // */ 187 | // 188 | //- (void)startIndicatorAnimating { 189 | // 190 | // if (_actIndicator == nil) { 191 | // _actIndicator = [[GCLoadingView alloc] initWithFrame:CGRectMake(0, 0, 90, 90)]; 192 | // NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication]windows]reverseObjectEnumerator]; 193 | // //NSArray *array = [frontToBackWindows allObjects]; 194 | // for (UIWindow *window in frontToBackWindows) 195 | // if (window.windowLevel == UIWindowLevelNormal) { 196 | // [window addSubview:_actIndicator]; 197 | // break; 198 | // } 199 | // // [self.view addSubview:_actIndicator]; 200 | // 201 | // CGRect rect = CGRectZero;//self.view.frame; 202 | // rect.size.width = kUIScreenWidth /self.view.transform.a; 203 | // rect.size.height = kUIScreenHeight/self.view.transform.d; 204 | // _actIndicator.frame = CGRectMake((rect.size.width - _actIndicator.frame.size.width) / 2, 205 | // (rect.size.height -_actIndicator.frame.size.height)/ 2, 206 | // _actIndicator.frame.size.width, 207 | // _actIndicator.frame.size.height); 208 | // } 209 | // // [self.view bringSubviewToFront:_actIndicator]; 210 | // [_actIndicator startAnimating]; 211 | //} 212 | // 213 | ///** 214 | // * 开始动画 enable 为yes时,表明loading图的时候用户还可以点击界面上的按钮,no则相反 215 | // */ 216 | //- (void)startIndicatorAnimatingWithViewEnable:(BOOL)enable { 217 | // 218 | // if (_backView == nil && !enable) { 219 | // _actIndicator = [[GCLoadingView alloc] initWithFrame:CGRectMake(0, 0, kUIScreenWidth , kUIScreenHeight - 64)]; 220 | // CGRect rect = self.view.frame; 221 | // _backView = [[UIView alloc] initWithFrame:rect]; 222 | // _backView.backgroundColor = [UIColor clearColor]; 223 | // [_backView addSubview:_actIndicator]; 224 | // [self.view addSubview:_backView]; 225 | // } 226 | // 227 | // [self.view bringSubviewToFront:_backView]; 228 | // [_actIndicator startAnimating]; 229 | //} 230 | // 231 | ///** 232 | // * 停止动画 233 | // */ 234 | //- (void)stopIndicatorAnimating { 235 | // 236 | // [_actIndicator stopAnimating]; 237 | // if (_backView) { 238 | // [_backView removeFromSuperview]; 239 | // } 240 | // _backView = nil; 241 | //} 242 | @end 243 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STTextHud.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STTextHudTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // STTextHudTool.h 3 | // LiqForDoctors 4 | // 5 | // Created by StriEver on 16/5/11. 6 | // Copyright © 2016年 iMac. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | @interface STTextHudTool : NSObject 12 | /** 13 | * 错误提示 默认 14 | * 15 | * @param text 文本 16 | */ 17 | + (void)showErrorText:(NSString *)text; 18 | /** 19 | * 粗无提示 20 | * 21 | * @param text 文本 22 | * @param delay 显示时间 23 | */ 24 | + (void)showErrorText:(NSString *)text withSecond:(NSInteger)delay; 25 | /** 26 | * 纯文本提示 27 | * 28 | * @param text 问题 29 | */ 30 | + (void)showText:(NSString *)text; 31 | /** 32 | * 纯文本提示 33 | * 34 | * @param text 文本 35 | * @param delay 显示时间 36 | */ 37 | + (void)showText:(NSString *)text withSecond:(NSInteger)delay; 38 | 39 | /** 40 | * 成功提示 41 | * 42 | * @param text 文本 43 | */ 44 | + (void)showSuccessText:(NSString *)text; 45 | /** 46 | * 成功提示 47 | * 48 | * @param text 文本 49 | * @param delay 显示时间 50 | */ 51 | + (void)showSuccessText:(NSString *)text withSecond:(NSInteger)delay; 52 | /** 53 | * 菊花等待提示 54 | * 55 | * @param text 文本 56 | */ 57 | + (void)showWaitText:(NSString *)text; 58 | /** 59 | * 菊花等待提示 60 | * 61 | * @param text 文本 62 | * @param delay 显示时间 63 | */ 64 | + (void)showWaitText:(NSString *)text delay:(NSInteger)delay; 65 | //显示级别较高,不会被其他的hud移除 直到自己消失 66 | + (void)showHightPriorityWaitText:(NSString *)text withSecond:(NSInteger)second; 67 | /** 68 | * 网络请求加载界面 69 | */ 70 | + (void)loading; 71 | /** 72 | * 带标题的网络请求加载界面 73 | * 74 | * @param title 标题 75 | */ 76 | +(void)loadingWithTitle:(NSString *)title; 77 | /** 78 | * 隐藏hud 79 | */ 80 | + (void)hideSTHud; 81 | + (void)showTextTitle:(NSString *)title WithCustomVew:(UIView *)customView; 82 | @end 83 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/STTextHudTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // STTextHudTool.m 3 | // LiqForDoctors 4 | // 5 | // Created by StriEver on 16/5/11. 6 | // Copyright © 2016年 iMac. All rights reserved. 7 | // 8 | 9 | #import "STTextHudTool.h" 10 | #import "STTextHud.h" 11 | #import "AppDelegate.h" 12 | #define defaultDely 1.5 13 | //超长时间 14 | #define timeOut 15 15 | @implementation STTextHudTool 16 | + (void)showText:(NSString *)text{ 17 | [self showText:text withSecond:defaultDely]; 18 | } 19 | + (void)showText:(NSString *)text withSecond:(NSInteger)delay{ 20 | STTextHud * hud = [[STTextHud alloc]init]; 21 | hud.hudStyle = STHudText; 22 | [hud showText:text withSecond:delay]; 23 | } 24 | + (void)showSuccessText:(NSString *)text{ 25 | [self showSuccessText:text withSecond:defaultDely]; 26 | } 27 | + (void)showSuccessText:(NSString *)text withSecond:(NSInteger)delay{ 28 | STTextHud * hud = [[STTextHud alloc]init]; 29 | hud.hudStyle = STHudSucess; 30 | [hud showText:text withSecond:delay]; 31 | } 32 | + (void)showErrorText:(NSString *)text{ 33 | [self showErrorText:text withSecond:defaultDely]; 34 | } 35 | + (void)showErrorText:(NSString *)text withSecond:(NSInteger)delay{ 36 | STTextHud * hud = [[STTextHud alloc]init]; 37 | hud.hudStyle = STHudError; 38 | [hud showText:text withSecond:delay]; 39 | } 40 | + (void)showWaitText:(NSString *)text delay:(NSInteger)delay{ 41 | STTextHud * hud = [[STTextHud alloc]init]; 42 | hud.hudStyle = STHudWait; 43 | [hud showText:text withSecond:delay]; 44 | } 45 | + (void)showHightPriorityWaitText:(NSString *)text withSecond:(NSInteger)second{ 46 | STTextHud * hud = [[STTextHud alloc]init]; 47 | hud.hudStyle = STHudWait; 48 | hud.priority = Priority_Hight; 49 | [hud showText:text withSecond:second]; 50 | } 51 | + (void)showWaitText:(NSString *)text{ 52 | STTextHud * hud = [[STTextHud alloc]init]; 53 | hud.hudStyle = STHudWait; 54 | [hud showText:text withSecond:timeOut]; 55 | } 56 | + (void)loading{ 57 | [self loadingWithTitle:nil]; 58 | } 59 | +(void)loadingWithTitle:(NSString *)title{ 60 | STTextHud * hud = [[STTextHud alloc]init]; 61 | if (!title || title.length == 0) { 62 | hud.hudStyle = STHudLoadingWithoutTitle; 63 | }else{ 64 | hud.hudStyle = STHudLoadingWithTitle; 65 | } 66 | [hud showText:title withSecond:timeOut]; 67 | } 68 | + (void)showTextTitle:(NSString *)title WithCustomVew:(UIView *)customView{ 69 | STTextHud * hud = [[STTextHud alloc]init]; 70 | hud.priority = Priority_Hight; 71 | hud.hudStyle = STHudLoadingWithCustomView; 72 | hud.customView = customView; 73 | [hud showText:title withSecond:111]; 74 | } 75 | 76 | 77 | + (void)hideSTHud{ 78 | UIWindow * current_window = nil; 79 | NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication]windows]reverseObjectEnumerator]; 80 | //NSArray *array = [frontToBackWindows allObjects]; 81 | for (UIWindow *window in frontToBackWindows) 82 | if (window.windowLevel == UIWindowLevelNormal) { 83 | current_window = window; 84 | break; 85 | } 86 | [current_window.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 87 | if ([obj isKindOfClass:[STTextHud class]]) { 88 | STTextHud * hud = (STTextHud *)obj; 89 | if (hud.priority !=Priority_Hight) { 90 | [hud hidStHud]; 91 | } 92 | } 93 | }]; 94 | } 95 | @end 96 | -------------------------------------------------------------------------------- /STHudTextDemo/STTextHud/angle-mask@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/STTextHud/angle-mask@3x.png -------------------------------------------------------------------------------- /STHudTextDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // STHudTextDemo 4 | // 5 | // Created by StriEver on 16/5/14. 6 | // Copyright © 2016年 StriEver. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /STHudTextDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // STHudTextDemo 4 | // 5 | // Created by StriEver on 16/5/14. 6 | // Copyright © 2016年 StriEver. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "STTextHud/STTextHudTool.h" 11 | #define customDelay 3 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | - (IBAction)btnClickAction:(UIButton *)sender { 28 | switch (sender.tag) { 29 | case 0: 30 | [STTextHudTool showText:@"我是没有设置延迟的提示信息哦"]; 31 | break; 32 | case 1: 33 | [STTextHudTool showText:@"我是设置了延迟的提示信息哦" withSecond:customDelay]; 34 | break; 35 | case 2: 36 | [STTextHudTool showSuccessText:@"提交成功"]; 37 | break; 38 | case 3: 39 | [STTextHudTool showSuccessText:@"提交成功" withSecond:customDelay]; 40 | break; 41 | case 4: 42 | [STTextHudTool showErrorText:@"密码错误"]; 43 | break; 44 | case 5: 45 | [STTextHudTool showErrorText:@"网络较差" withSecond:customDelay]; 46 | break; 47 | case 6: 48 | [STTextHudTool loading]; 49 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(customDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 50 | 51 | [STTextHudTool hideSTHud]; 52 | }); 53 | break; 54 | case 7: 55 | [STTextHudTool loadingWithTitle:@"加载中..."]; 56 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(customDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 57 | 58 | [STTextHudTool hideSTHud]; 59 | }); 60 | break; 61 | case 8: 62 | [STTextHudTool showWaitText:@"正在加载数据"]; 63 | break; 64 | case 9: 65 | [STTextHudTool showWaitText:@"正在加载" delay:customDelay]; 66 | break; 67 | 68 | default: 69 | break; 70 | } 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /STHudTextDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // STHudTextDemo 4 | // 5 | // Created by StriEver on 16/5/14. 6 | // Copyright © 2016年 StriEver. 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 | -------------------------------------------------------------------------------- /STHudTextDemo/截图/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/0.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/1.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/2.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/3.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/4.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/5.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/6.png -------------------------------------------------------------------------------- /STHudTextDemo/截图/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/strivever/STTTextHud/e5bc3d8fae624bf7adda4712a704d5ab95118e46/STHudTextDemo/截图/7.png --------------------------------------------------------------------------------