├── README.md ├── SSProgressHUD.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── yangshuquan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── yangshuquan.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── SSProgressHUD ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── sq_success.imageset │ │ ├── Contents.json │ │ ├── sq_success@2x.png │ │ └── sq_success@3x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SSProgressHUD │ ├── SSProgressHUD.h │ └── SSProgressHUD.m ├── ViewController.h ├── ViewController.m └── main.m ├── SSProgressHUDTests ├── Info.plist └── SSProgressHUDTests.m ├── SSProgressHUDUITests ├── Info.plist └── SSProgressHUDUITests.m ├── loadingGif.gif ├── progressGif.gif ├── showImage.gif └── showTextGif.gif /README.md: -------------------------------------------------------------------------------- 1 | # SSProgressHUD 2 | 加载动画提示、文字和图片提示、进度加载提示、可自定义 3 | 4 | 5 | # 预览动画 6 | 7 | 8 | 9 | 10 | 11 | # 功能说明 12 | - loading动画加文字自适应 13 | - 文字提示,支持视图消失时回调 14 | - 图片加文字提示自适应,支持视图消失时回调 15 | - 进度加载,支持全部加载时回调 16 | - 可自定义customView 17 | - 多种属性设置,例如:颜色风格、遮罩类型、中心点偏移 18 | - 提供分类API调用 19 | - 可以同时显示多个hud,通过tag标记显示移除 20 | 21 | # 具体使用 22 | 23 | ### 例如Loading加文字 24 | 25 | ``` 26 | SSProgressHUD *hud = [[SSProgressHUD alloc]initWithMode:SSProgressHUDModeLoadingAndText]; 27 | hud.customText = text; 28 | [hud showOnView:self.view animated:YES]; 29 | ``` 30 | 31 | ### 通过中点偏移量自定义hud的位置 32 | ``` 33 | hud.viewCenterOffet = CGPointMake(0,-20); 34 | ``` 35 | 36 | ### 设置自定义视图的内间距 37 | ``` 38 | hud.customViewEdgeInsets = UIEdgeInsetsMake(20,20,20,20); 39 | ``` 40 | 41 | ### 自定义视图 42 | ``` 43 | UIView *customView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 90, 200)]; 44 | SSProgressHUD *hud = [[SSProgressHUD alloc]initWithCustomView:customView] 45 | ``` 46 | 47 | ### 快捷调用API 48 | ``` 49 | @interface NSObject (SSProgressHUD) 50 | 51 | /* 52 | *tag参数的说明: 53 | 1、当tag等于-1或者大于0的时候,每个tag对应一个hud。 54 | 2、如果展示的是文字提示的tag为0,不会缓存hud。 55 | 3、loading的时候默认tag为-1; 56 | 57 | */ 58 | 59 | 60 | ///loading,没文字 61 | - (void)showLoading; 62 | - (void)showLoadingWithMaskType:(SSProgressHUDMaskType)maskType; 63 | 64 | - (void)showLoadingWithTag:(NSInteger)tag; 65 | - (void)showLoadingWithTag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType; 66 | 67 | ///loading,有文字 68 | - (void)showLoadingText:(NSString * _Nullable )text; 69 | - (void)showLoadingText:(NSString * _Nullable )text maskType:(SSProgressHUDMaskType)maskType; 70 | 71 | - (void)showLoadingText:(NSString * _Nullable )text tag:(NSInteger)tag; 72 | - (void)showLoadingText:(NSString * _Nullable )text tag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType; 73 | 74 | ///文字提示 75 | - (void)showText:(NSString *)text; 76 | ///文字提示,有消失时回调 77 | - (void)showText:(NSString *)text finished:(void(^ __nullable)(void))finished; 78 | - (void)showText:(NSString *)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished; 79 | 80 | ///进度条 81 | - (void)showProgress:(CGFloat)progress finished:(void(^ __nullable)(void))finished; 82 | - (void)showProgress:(CGFloat)progress maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished; 83 | 84 | - (void)showProgress:(CGFloat)progress text:(NSString * _Nullable)text finished:(void(^ __nullable)(void))finished; 85 | - (void)showProgress:(CGFloat)progress text:(NSString * _Nullable)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished; 86 | 87 | 88 | ///图片 89 | - (void)showHUDWithImageName:(NSString *)imageName; 90 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString * _Nullable)text; 91 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString * _Nullable)text finished:(void(^__nullable)(void))finished; 92 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString * _Nullable)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^__nullable)(void))finished; 93 | 94 | 95 | ///隐藏 96 | - (void)hideHUD; 97 | - (void)hideHUDWithTag:(NSInteger)tag; 98 | 99 | - (void)hideHUDAnimated:(BOOL)animated; 100 | - (void)hideHUDAnimated:(BOOL)animated tag:(NSInteger)tag; 101 | 102 | - (void)hideHUDAnimated:(BOOL)animated finished:(void(^ __nullable)(void))finished; 103 | - (void)hideHUDAnimated:(BOOL)animated tag:(NSInteger)tag finished:(void(^ __nullable)(void))finished; 104 | 105 | @end 106 | ``` 107 | 108 | 109 | 110 | 其他功能具体请看Demo的用法 111 | 112 | 113 | -------------------------------------------------------------------------------- /SSProgressHUD.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A52B776A21D5DA6D0084330C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B776921D5DA6D0084330C /* AppDelegate.m */; }; 11 | A52B776D21D5DA6D0084330C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B776C21D5DA6D0084330C /* ViewController.m */; }; 12 | A52B777021D5DA6D0084330C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A52B776E21D5DA6D0084330C /* Main.storyboard */; }; 13 | A52B777221D5DA6F0084330C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A52B777121D5DA6F0084330C /* Assets.xcassets */; }; 14 | A52B777521D5DA6F0084330C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A52B777321D5DA6F0084330C /* LaunchScreen.storyboard */; }; 15 | A52B777821D5DA6F0084330C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B777721D5DA6F0084330C /* main.m */; }; 16 | A52B778221D5DA6F0084330C /* SSProgressHUDTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B778121D5DA6F0084330C /* SSProgressHUDTests.m */; }; 17 | A52B778D21D5DA6F0084330C /* SSProgressHUDUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B778C21D5DA6F0084330C /* SSProgressHUDUITests.m */; }; 18 | A52B779C21D5DB480084330C /* SSProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = A52B779B21D5DB480084330C /* SSProgressHUD.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | A52B777E21D5DA6F0084330C /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = A52B775D21D5DA6D0084330C /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = A52B776421D5DA6D0084330C; 27 | remoteInfo = SSProgressHUD; 28 | }; 29 | A52B778921D5DA6F0084330C /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = A52B775D21D5DA6D0084330C /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = A52B776421D5DA6D0084330C; 34 | remoteInfo = SSProgressHUD; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | A52B776521D5DA6D0084330C /* SSProgressHUD.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SSProgressHUD.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | A52B776821D5DA6D0084330C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | A52B776921D5DA6D0084330C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | A52B776B21D5DA6D0084330C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | A52B776C21D5DA6D0084330C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | A52B776F21D5DA6D0084330C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | A52B777121D5DA6F0084330C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | A52B777421D5DA6F0084330C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | A52B777621D5DA6F0084330C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | A52B777721D5DA6F0084330C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | A52B777D21D5DA6F0084330C /* SSProgressHUDTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SSProgressHUDTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | A52B778121D5DA6F0084330C /* SSProgressHUDTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSProgressHUDTests.m; sourceTree = ""; }; 51 | A52B778321D5DA6F0084330C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | A52B778821D5DA6F0084330C /* SSProgressHUDUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SSProgressHUDUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | A52B778C21D5DA6F0084330C /* SSProgressHUDUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSProgressHUDUITests.m; sourceTree = ""; }; 54 | A52B778E21D5DA6F0084330C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | A52B779A21D5DB480084330C /* SSProgressHUD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SSProgressHUD.h; sourceTree = ""; }; 56 | A52B779B21D5DB480084330C /* SSProgressHUD.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSProgressHUD.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | A52B776221D5DA6D0084330C /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | A52B777A21D5DA6F0084330C /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | A52B778521D5DA6F0084330C /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | A52B775C21D5DA6C0084330C = { 85 | isa = PBXGroup; 86 | children = ( 87 | A52B776721D5DA6D0084330C /* SSProgressHUD */, 88 | A52B778021D5DA6F0084330C /* SSProgressHUDTests */, 89 | A52B778B21D5DA6F0084330C /* SSProgressHUDUITests */, 90 | A52B776621D5DA6D0084330C /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | A52B776621D5DA6D0084330C /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | A52B776521D5DA6D0084330C /* SSProgressHUD.app */, 98 | A52B777D21D5DA6F0084330C /* SSProgressHUDTests.xctest */, 99 | A52B778821D5DA6F0084330C /* SSProgressHUDUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | A52B776721D5DA6D0084330C /* SSProgressHUD */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | A53F754021DB516F00E164E2 /* SSProgressHUD */, 108 | A52B776821D5DA6D0084330C /* AppDelegate.h */, 109 | A52B776921D5DA6D0084330C /* AppDelegate.m */, 110 | A52B776B21D5DA6D0084330C /* ViewController.h */, 111 | A52B776C21D5DA6D0084330C /* ViewController.m */, 112 | A52B776E21D5DA6D0084330C /* Main.storyboard */, 113 | A52B777121D5DA6F0084330C /* Assets.xcassets */, 114 | A52B777321D5DA6F0084330C /* LaunchScreen.storyboard */, 115 | A52B777621D5DA6F0084330C /* Info.plist */, 116 | A52B777721D5DA6F0084330C /* main.m */, 117 | ); 118 | path = SSProgressHUD; 119 | sourceTree = ""; 120 | }; 121 | A52B778021D5DA6F0084330C /* SSProgressHUDTests */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | A52B778121D5DA6F0084330C /* SSProgressHUDTests.m */, 125 | A52B778321D5DA6F0084330C /* Info.plist */, 126 | ); 127 | path = SSProgressHUDTests; 128 | sourceTree = ""; 129 | }; 130 | A52B778B21D5DA6F0084330C /* SSProgressHUDUITests */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | A52B778C21D5DA6F0084330C /* SSProgressHUDUITests.m */, 134 | A52B778E21D5DA6F0084330C /* Info.plist */, 135 | ); 136 | path = SSProgressHUDUITests; 137 | sourceTree = ""; 138 | }; 139 | A53F754021DB516F00E164E2 /* SSProgressHUD */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | A52B779A21D5DB480084330C /* SSProgressHUD.h */, 143 | A52B779B21D5DB480084330C /* SSProgressHUD.m */, 144 | ); 145 | path = SSProgressHUD; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | A52B776421D5DA6D0084330C /* SSProgressHUD */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = A52B779121D5DA6F0084330C /* Build configuration list for PBXNativeTarget "SSProgressHUD" */; 154 | buildPhases = ( 155 | A52B776121D5DA6D0084330C /* Sources */, 156 | A52B776221D5DA6D0084330C /* Frameworks */, 157 | A52B776321D5DA6D0084330C /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = SSProgressHUD; 164 | productName = SSProgressHUD; 165 | productReference = A52B776521D5DA6D0084330C /* SSProgressHUD.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | A52B777C21D5DA6F0084330C /* SSProgressHUDTests */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = A52B779421D5DA6F0084330C /* Build configuration list for PBXNativeTarget "SSProgressHUDTests" */; 171 | buildPhases = ( 172 | A52B777921D5DA6F0084330C /* Sources */, 173 | A52B777A21D5DA6F0084330C /* Frameworks */, 174 | A52B777B21D5DA6F0084330C /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | A52B777F21D5DA6F0084330C /* PBXTargetDependency */, 180 | ); 181 | name = SSProgressHUDTests; 182 | productName = SSProgressHUDTests; 183 | productReference = A52B777D21D5DA6F0084330C /* SSProgressHUDTests.xctest */; 184 | productType = "com.apple.product-type.bundle.unit-test"; 185 | }; 186 | A52B778721D5DA6F0084330C /* SSProgressHUDUITests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = A52B779721D5DA6F0084330C /* Build configuration list for PBXNativeTarget "SSProgressHUDUITests" */; 189 | buildPhases = ( 190 | A52B778421D5DA6F0084330C /* Sources */, 191 | A52B778521D5DA6F0084330C /* Frameworks */, 192 | A52B778621D5DA6F0084330C /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | A52B778A21D5DA6F0084330C /* PBXTargetDependency */, 198 | ); 199 | name = SSProgressHUDUITests; 200 | productName = SSProgressHUDUITests; 201 | productReference = A52B778821D5DA6F0084330C /* SSProgressHUDUITests.xctest */; 202 | productType = "com.apple.product-type.bundle.ui-testing"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | A52B775D21D5DA6D0084330C /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastUpgradeCheck = 1010; 211 | ORGANIZATIONNAME = Shuqy; 212 | TargetAttributes = { 213 | A52B776421D5DA6D0084330C = { 214 | CreatedOnToolsVersion = 10.1; 215 | }; 216 | A52B777C21D5DA6F0084330C = { 217 | CreatedOnToolsVersion = 10.1; 218 | TestTargetID = A52B776421D5DA6D0084330C; 219 | }; 220 | A52B778721D5DA6F0084330C = { 221 | CreatedOnToolsVersion = 10.1; 222 | TestTargetID = A52B776421D5DA6D0084330C; 223 | }; 224 | }; 225 | }; 226 | buildConfigurationList = A52B776021D5DA6D0084330C /* Build configuration list for PBXProject "SSProgressHUD" */; 227 | compatibilityVersion = "Xcode 9.3"; 228 | developmentRegion = en; 229 | hasScannedForEncodings = 0; 230 | knownRegions = ( 231 | en, 232 | Base, 233 | ); 234 | mainGroup = A52B775C21D5DA6C0084330C; 235 | productRefGroup = A52B776621D5DA6D0084330C /* Products */; 236 | projectDirPath = ""; 237 | projectRoot = ""; 238 | targets = ( 239 | A52B776421D5DA6D0084330C /* SSProgressHUD */, 240 | A52B777C21D5DA6F0084330C /* SSProgressHUDTests */, 241 | A52B778721D5DA6F0084330C /* SSProgressHUDUITests */, 242 | ); 243 | }; 244 | /* End PBXProject section */ 245 | 246 | /* Begin PBXResourcesBuildPhase section */ 247 | A52B776321D5DA6D0084330C /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | A52B777521D5DA6F0084330C /* LaunchScreen.storyboard in Resources */, 252 | A52B777221D5DA6F0084330C /* Assets.xcassets in Resources */, 253 | A52B777021D5DA6D0084330C /* Main.storyboard in Resources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | A52B777B21D5DA6F0084330C /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | A52B778621D5DA6F0084330C /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXResourcesBuildPhase section */ 272 | 273 | /* Begin PBXSourcesBuildPhase section */ 274 | A52B776121D5DA6D0084330C /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | A52B776D21D5DA6D0084330C /* ViewController.m in Sources */, 279 | A52B777821D5DA6F0084330C /* main.m in Sources */, 280 | A52B779C21D5DB480084330C /* SSProgressHUD.m in Sources */, 281 | A52B776A21D5DA6D0084330C /* AppDelegate.m in Sources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | A52B777921D5DA6F0084330C /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | A52B778221D5DA6F0084330C /* SSProgressHUDTests.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | A52B778421D5DA6F0084330C /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | A52B778D21D5DA6F0084330C /* SSProgressHUDUITests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXTargetDependency section */ 304 | A52B777F21D5DA6F0084330C /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = A52B776421D5DA6D0084330C /* SSProgressHUD */; 307 | targetProxy = A52B777E21D5DA6F0084330C /* PBXContainerItemProxy */; 308 | }; 309 | A52B778A21D5DA6F0084330C /* PBXTargetDependency */ = { 310 | isa = PBXTargetDependency; 311 | target = A52B776421D5DA6D0084330C /* SSProgressHUD */; 312 | targetProxy = A52B778921D5DA6F0084330C /* PBXContainerItemProxy */; 313 | }; 314 | /* End PBXTargetDependency section */ 315 | 316 | /* Begin PBXVariantGroup section */ 317 | A52B776E21D5DA6D0084330C /* Main.storyboard */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | A52B776F21D5DA6D0084330C /* Base */, 321 | ); 322 | name = Main.storyboard; 323 | sourceTree = ""; 324 | }; 325 | A52B777321D5DA6F0084330C /* LaunchScreen.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | A52B777421D5DA6F0084330C /* Base */, 329 | ); 330 | name = LaunchScreen.storyboard; 331 | sourceTree = ""; 332 | }; 333 | /* End PBXVariantGroup section */ 334 | 335 | /* Begin XCBuildConfiguration section */ 336 | A52B778F21D5DA6F0084330C /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_ANALYZER_NONNULL = YES; 341 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_ENABLE_OBJC_WEAK = YES; 347 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_COMMA = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 352 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 353 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 354 | CLANG_WARN_EMPTY_BODY = YES; 355 | CLANG_WARN_ENUM_CONVERSION = YES; 356 | CLANG_WARN_INFINITE_RECURSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 359 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 360 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 363 | CLANG_WARN_STRICT_PROTOTYPES = YES; 364 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 365 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 366 | CLANG_WARN_UNREACHABLE_CODE = YES; 367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 368 | CODE_SIGN_IDENTITY = "iPhone Developer"; 369 | COPY_PHASE_STRIP = NO; 370 | DEBUG_INFORMATION_FORMAT = dwarf; 371 | ENABLE_STRICT_OBJC_MSGSEND = YES; 372 | ENABLE_TESTABILITY = YES; 373 | GCC_C_LANGUAGE_STANDARD = gnu11; 374 | GCC_DYNAMIC_NO_PIC = NO; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_OPTIMIZATION_LEVEL = 0; 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 388 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 389 | MTL_FAST_MATH = YES; 390 | ONLY_ACTIVE_ARCH = YES; 391 | SDKROOT = iphoneos; 392 | }; 393 | name = Debug; 394 | }; 395 | A52B779021D5DA6F0084330C /* Release */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_ANALYZER_NONNULL = YES; 400 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 401 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 402 | CLANG_CXX_LIBRARY = "libc++"; 403 | CLANG_ENABLE_MODULES = YES; 404 | CLANG_ENABLE_OBJC_ARC = YES; 405 | CLANG_ENABLE_OBJC_WEAK = YES; 406 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 407 | CLANG_WARN_BOOL_CONVERSION = YES; 408 | CLANG_WARN_COMMA = YES; 409 | CLANG_WARN_CONSTANT_CONVERSION = YES; 410 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 411 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 412 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 413 | CLANG_WARN_EMPTY_BODY = YES; 414 | CLANG_WARN_ENUM_CONVERSION = YES; 415 | CLANG_WARN_INFINITE_RECURSION = YES; 416 | CLANG_WARN_INT_CONVERSION = YES; 417 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 418 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 422 | CLANG_WARN_STRICT_PROTOTYPES = YES; 423 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 424 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 425 | CLANG_WARN_UNREACHABLE_CODE = YES; 426 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 427 | CODE_SIGN_IDENTITY = "iPhone Developer"; 428 | COPY_PHASE_STRIP = NO; 429 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 430 | ENABLE_NS_ASSERTIONS = NO; 431 | ENABLE_STRICT_OBJC_MSGSEND = YES; 432 | GCC_C_LANGUAGE_STANDARD = gnu11; 433 | GCC_NO_COMMON_BLOCKS = YES; 434 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 435 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 436 | GCC_WARN_UNDECLARED_SELECTOR = YES; 437 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 438 | GCC_WARN_UNUSED_FUNCTION = YES; 439 | GCC_WARN_UNUSED_VARIABLE = YES; 440 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 441 | MTL_ENABLE_DEBUG_INFO = NO; 442 | MTL_FAST_MATH = YES; 443 | SDKROOT = iphoneos; 444 | VALIDATE_PRODUCT = YES; 445 | }; 446 | name = Release; 447 | }; 448 | A52B779221D5DA6F0084330C /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 452 | CODE_SIGN_STYLE = Automatic; 453 | DEVELOPMENT_TEAM = 5P9S3466C2; 454 | INFOPLIST_FILE = SSProgressHUD/Info.plist; 455 | LD_RUNPATH_SEARCH_PATHS = ( 456 | "$(inherited)", 457 | "@executable_path/Frameworks", 458 | ); 459 | PRODUCT_BUNDLE_IDENTIFIER = shuqy.SSProgressHUD; 460 | PRODUCT_NAME = "$(TARGET_NAME)"; 461 | TARGETED_DEVICE_FAMILY = "1,2"; 462 | }; 463 | name = Debug; 464 | }; 465 | A52B779321D5DA6F0084330C /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | buildSettings = { 468 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 469 | CODE_SIGN_STYLE = Automatic; 470 | DEVELOPMENT_TEAM = 5P9S3466C2; 471 | INFOPLIST_FILE = SSProgressHUD/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = ( 473 | "$(inherited)", 474 | "@executable_path/Frameworks", 475 | ); 476 | PRODUCT_BUNDLE_IDENTIFIER = shuqy.SSProgressHUD; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TARGETED_DEVICE_FAMILY = "1,2"; 479 | }; 480 | name = Release; 481 | }; 482 | A52B779521D5DA6F0084330C /* Debug */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | BUNDLE_LOADER = "$(TEST_HOST)"; 486 | CODE_SIGN_STYLE = Automatic; 487 | INFOPLIST_FILE = SSProgressHUDTests/Info.plist; 488 | LD_RUNPATH_SEARCH_PATHS = ( 489 | "$(inherited)", 490 | "@executable_path/Frameworks", 491 | "@loader_path/Frameworks", 492 | ); 493 | PRODUCT_BUNDLE_IDENTIFIER = shuqy.SSProgressHUDTests; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | TARGETED_DEVICE_FAMILY = "1,2"; 496 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SSProgressHUD.app/SSProgressHUD"; 497 | }; 498 | name = Debug; 499 | }; 500 | A52B779621D5DA6F0084330C /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | BUNDLE_LOADER = "$(TEST_HOST)"; 504 | CODE_SIGN_STYLE = Automatic; 505 | INFOPLIST_FILE = SSProgressHUDTests/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "@executable_path/Frameworks", 509 | "@loader_path/Frameworks", 510 | ); 511 | PRODUCT_BUNDLE_IDENTIFIER = shuqy.SSProgressHUDTests; 512 | PRODUCT_NAME = "$(TARGET_NAME)"; 513 | TARGETED_DEVICE_FAMILY = "1,2"; 514 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SSProgressHUD.app/SSProgressHUD"; 515 | }; 516 | name = Release; 517 | }; 518 | A52B779821D5DA6F0084330C /* Debug */ = { 519 | isa = XCBuildConfiguration; 520 | buildSettings = { 521 | CODE_SIGN_STYLE = Automatic; 522 | INFOPLIST_FILE = SSProgressHUDUITests/Info.plist; 523 | LD_RUNPATH_SEARCH_PATHS = ( 524 | "$(inherited)", 525 | "@executable_path/Frameworks", 526 | "@loader_path/Frameworks", 527 | ); 528 | PRODUCT_BUNDLE_IDENTIFIER = shuqy.SSProgressHUDUITests; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | TARGETED_DEVICE_FAMILY = "1,2"; 531 | TEST_TARGET_NAME = SSProgressHUD; 532 | }; 533 | name = Debug; 534 | }; 535 | A52B779921D5DA6F0084330C /* Release */ = { 536 | isa = XCBuildConfiguration; 537 | buildSettings = { 538 | CODE_SIGN_STYLE = Automatic; 539 | INFOPLIST_FILE = SSProgressHUDUITests/Info.plist; 540 | LD_RUNPATH_SEARCH_PATHS = ( 541 | "$(inherited)", 542 | "@executable_path/Frameworks", 543 | "@loader_path/Frameworks", 544 | ); 545 | PRODUCT_BUNDLE_IDENTIFIER = shuqy.SSProgressHUDUITests; 546 | PRODUCT_NAME = "$(TARGET_NAME)"; 547 | TARGETED_DEVICE_FAMILY = "1,2"; 548 | TEST_TARGET_NAME = SSProgressHUD; 549 | }; 550 | name = Release; 551 | }; 552 | /* End XCBuildConfiguration section */ 553 | 554 | /* Begin XCConfigurationList section */ 555 | A52B776021D5DA6D0084330C /* Build configuration list for PBXProject "SSProgressHUD" */ = { 556 | isa = XCConfigurationList; 557 | buildConfigurations = ( 558 | A52B778F21D5DA6F0084330C /* Debug */, 559 | A52B779021D5DA6F0084330C /* Release */, 560 | ); 561 | defaultConfigurationIsVisible = 0; 562 | defaultConfigurationName = Release; 563 | }; 564 | A52B779121D5DA6F0084330C /* Build configuration list for PBXNativeTarget "SSProgressHUD" */ = { 565 | isa = XCConfigurationList; 566 | buildConfigurations = ( 567 | A52B779221D5DA6F0084330C /* Debug */, 568 | A52B779321D5DA6F0084330C /* Release */, 569 | ); 570 | defaultConfigurationIsVisible = 0; 571 | defaultConfigurationName = Release; 572 | }; 573 | A52B779421D5DA6F0084330C /* Build configuration list for PBXNativeTarget "SSProgressHUDTests" */ = { 574 | isa = XCConfigurationList; 575 | buildConfigurations = ( 576 | A52B779521D5DA6F0084330C /* Debug */, 577 | A52B779621D5DA6F0084330C /* Release */, 578 | ); 579 | defaultConfigurationIsVisible = 0; 580 | defaultConfigurationName = Release; 581 | }; 582 | A52B779721D5DA6F0084330C /* Build configuration list for PBXNativeTarget "SSProgressHUDUITests" */ = { 583 | isa = XCConfigurationList; 584 | buildConfigurations = ( 585 | A52B779821D5DA6F0084330C /* Debug */, 586 | A52B779921D5DA6F0084330C /* Release */, 587 | ); 588 | defaultConfigurationIsVisible = 0; 589 | defaultConfigurationName = Release; 590 | }; 591 | /* End XCConfigurationList section */ 592 | }; 593 | rootObject = A52B775D21D5DA6D0084330C /* Project object */; 594 | } 595 | -------------------------------------------------------------------------------- /SSProgressHUD.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SSProgressHUD.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SSProgressHUD.xcodeproj/project.xcworkspace/xcuserdata/yangshuquan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/SSProgressHUD.xcodeproj/project.xcworkspace/xcuserdata/yangshuquan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SSProgressHUD.xcodeproj/xcuserdata/yangshuquan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /SSProgressHUD.xcodeproj/xcuserdata/yangshuquan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SSProgressHUD.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SSProgressHUD/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. 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 | -------------------------------------------------------------------------------- /SSProgressHUD/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. 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 | -------------------------------------------------------------------------------- /SSProgressHUD/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /SSProgressHUD/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SSProgressHUD/Assets.xcassets/sq_success.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sq_success@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "sq_success@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /SSProgressHUD/Assets.xcassets/sq_success.imageset/sq_success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/SSProgressHUD/Assets.xcassets/sq_success.imageset/sq_success@2x.png -------------------------------------------------------------------------------- /SSProgressHUD/Assets.xcassets/sq_success.imageset/sq_success@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/SSProgressHUD/Assets.xcassets/sq_success.imageset/sq_success@3x.png -------------------------------------------------------------------------------- /SSProgressHUD/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 | -------------------------------------------------------------------------------- /SSProgressHUD/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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /SSProgressHUD/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /SSProgressHUD/SSProgressHUD/SSProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSProgressHUD.h 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | typedef NS_ENUM(NSInteger,SSProgressHUDMode) { 13 | ///默认loading,不带文字 14 | SSProgressHUDModeLoading, 15 | ///loading&文字 16 | SSProgressHUDModeLoadingAndText, 17 | ///文字提示 18 | SSProgressHUDModeText, 19 | ///进度条 20 | SSProgressHUDModeProgressValue, 21 | ///图标 22 | SSProgressHUDModeImage 23 | }; 24 | 25 | 26 | /** 27 | 遮罩的类型,有遮罩不能点击遮罩下的事件 28 | */ 29 | typedef NS_ENUM(NSInteger, SSProgressHUDMaskType) { 30 | ///没有遮罩 31 | SSProgressHUDMaskTypeNone, 32 | ///黑色遮罩 33 | SSProgressHUDMaskTypeBlack, 34 | ///透明遮罩 35 | SSProgressHUDMaskTypeClear 36 | }; 37 | /** 38 | 颜色风格 39 | */ 40 | typedef NS_ENUM(NSInteger, SSProgressHUDColorType) { 41 | ///默认风格 42 | SSProgressHUDColorTypeDefault, 43 | ///黑色调风格 44 | SSProgressHUDColorTypeBlack, 45 | } ; 46 | 47 | 48 | NS_ASSUME_NONNULL_BEGIN 49 | 50 | @interface SSProgressHUD : UIView 51 | ///改变颜色风格 52 | @property(nonatomic, assign) SSProgressHUDColorType colorType; 53 | ///hud的中心偏移量,x:大于零向右,小于0向左 y:大于零向下,小于0向上 54 | @property(nonatomic, assign) CGPoint viewCenterOffet; 55 | ///自定义视图的边距,top,left,bottom,right 56 | @property(nonatomic, assign) UIEdgeInsets customViewEdgeInsets; 57 | ///改变内容的颜色 58 | @property (nonatomic, strong) UIColor *customContentColor; 59 | ///文字 60 | @property(nonatomic, copy) NSString *customText; 61 | ///文字颜色 62 | @property(nonatomic, strong) UIColor *customTextColor; 63 | ///文字大小 64 | @property(nonatomic, strong) UIFont *customTextFont; 65 | ///进度 66 | @property(nonatomic, assign) CGFloat customProgress; 67 | ///图片 68 | @property(nonatomic, strong) UIImage *customImage; 69 | 70 | 71 | ///初始化方法 72 | - (instancetype)initWithMode:(SSProgressHUDMode)mode; 73 | - (instancetype)initWithCustomView:(UIView *)customView; 74 | 75 | /** 76 | 开始展示 77 | 78 | @param view 显示的父视图 79 | @param animated 是否动画,默认yes 80 | */ 81 | 82 | - (void)showOnView:(UIView *)view animated:(BOOL)animated; 83 | - (void)showOnView:(UIView *)view animated:(BOOL)animated maskType:(SSProgressHUDMaskType)maskType; 84 | 85 | /** 86 | 隐藏 87 | 88 | @param animated 是否动画,默认yes 89 | */ 90 | - (void)hideViewAnimated:(BOOL)animated; 91 | - (void)hideViewAnimated:(BOOL)animated completion:(void(^__nullable)(void))completion; 92 | 93 | 94 | /** 95 | 设置进度 96 | 97 | @param progress 进度数值 98 | @param finished 100%的回调 99 | */ 100 | - (void)setCustomProgress:(CGFloat)progress finished:(void(^__nullable)(void))finished; 101 | 102 | @end 103 | 104 | ///自定义视图 105 | @interface SSProgressCustomView : UIView 106 | 107 | ///改变内容的颜色 108 | @property (nonatomic, strong) UIColor *contentColor; 109 | ///文字 110 | @property(nonatomic, copy) NSString *text; 111 | ///文字颜色 112 | @property(nonatomic, strong) UIColor *textColor; 113 | ///文字大小 114 | @property(nonatomic, strong) UIFont *textFont; 115 | 116 | 117 | @end 118 | 119 | ////loading,text,loading and text 120 | @interface SSProgressLoadTextView : SSProgressCustomView 121 | - (instancetype)initWithMode:(SSProgressHUDMode)mode; 122 | @end 123 | 124 | 125 | ///进度条 126 | @interface SSProgressValueView:SSProgressCustomView 127 | ///进度 128 | @property (nonatomic, assign) CGFloat progress; 129 | @end 130 | 131 | 132 | @interface SSProgressImageView:SSProgressCustomView 133 | ///图片 134 | @property (nonatomic, strong) UIImage *image; 135 | @end 136 | 137 | 138 | @interface NSObject (SSProgressHUD) 139 | 140 | /* 141 | *tag参数的说明: 142 | 1、当tag等于-1或者大于0的时候,每个tag对应一个hud。 143 | 2、如果展示的是文字提示的tag为0,不会缓存hud。 144 | 3、loading的时候默认tag为-1; 145 | 146 | */ 147 | 148 | 149 | ///loading,没文字 150 | - (void)showLoading; 151 | - (void)showLoadingWithMaskType:(SSProgressHUDMaskType)maskType; 152 | 153 | - (void)showLoadingWithTag:(NSInteger)tag; 154 | - (void)showLoadingWithTag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType; 155 | 156 | ///loading,有文字 157 | - (void)showLoadingText:(NSString * _Nullable )text; 158 | - (void)showLoadingText:(NSString * _Nullable )text maskType:(SSProgressHUDMaskType)maskType; 159 | 160 | - (void)showLoadingText:(NSString * _Nullable )text tag:(NSInteger)tag; 161 | - (void)showLoadingText:(NSString * _Nullable )text tag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType; 162 | 163 | ///文字提示 164 | - (void)showText:(NSString *)text; 165 | ///文字提示,有消失时回调 166 | - (void)showText:(NSString *)text finished:(void(^ __nullable)(void))finished; 167 | - (void)showText:(NSString *)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished; 168 | 169 | ///进度条 170 | - (void)showProgress:(CGFloat)progress finished:(void(^ __nullable)(void))finished; 171 | - (void)showProgress:(CGFloat)progress maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished; 172 | 173 | - (void)showProgress:(CGFloat)progress text:(NSString * _Nullable)text finished:(void(^ __nullable)(void))finished; 174 | - (void)showProgress:(CGFloat)progress text:(NSString * _Nullable)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished; 175 | 176 | 177 | ///图片 178 | - (void)showHUDWithImageName:(NSString *)imageName; 179 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString * _Nullable)text; 180 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString * _Nullable)text finished:(void(^__nullable)(void))finished; 181 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString * _Nullable)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^__nullable)(void))finished; 182 | 183 | 184 | ///隐藏 185 | - (void)hideHUD; 186 | - (void)hideHUDWithTag:(NSInteger)tag; 187 | 188 | - (void)hideHUDAnimated:(BOOL)animated; 189 | - (void)hideHUDAnimated:(BOOL)animated tag:(NSInteger)tag; 190 | 191 | - (void)hideHUDAnimated:(BOOL)animated finished:(void(^ __nullable)(void))finished; 192 | - (void)hideHUDAnimated:(BOOL)animated tag:(NSInteger)tag finished:(void(^ __nullable)(void))finished; 193 | 194 | @end 195 | 196 | 197 | NS_ASSUME_NONNULL_END 198 | -------------------------------------------------------------------------------- /SSProgressHUD/SSProgressHUD/SSProgressHUD.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSProgressHUD.m 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. All rights reserved. 7 | // 8 | 9 | #import "SSProgressHUD.h" 10 | #import 11 | #define SSProgressHUDTextMaxWidth ([UIScreen mainScreen].bounds.size.width * 0.75) 12 | 13 | static const CGFloat kDuration = 1.f; //圆圈动画的时间 14 | static const CGFloat kLineWidth = 2.f;//圆圈动画线的宽度 15 | static const CGFloat kTextLabelFont = 15.f;//提示文字的字体大小 16 | static const CGFloat kArcRadius = 20.f;//圆圈的半径 17 | static const CGFloat kTextArcRadius = 16.f;//有文字时,圆圈的半径 18 | static const CGFloat kLoadAndTextSpace = 10.f; //圆圈和文字的间隔 19 | 20 | 21 | 22 | @interface SSProgressArcView : UIView 23 | { 24 | CABasicAnimation *_animation1, *_animation2; 25 | } 26 | @property(nonatomic, strong) UIColor *lineColor; 27 | @property (nonatomic, assign) CGFloat progress; 28 | 29 | 30 | - (instancetype)initWithMode:(SSProgressHUDMode)mode; 31 | 32 | @end 33 | 34 | @interface SSProgressArcView () 35 | @property(nonatomic, strong) UIBezierPath *bezierPath; 36 | @property(nonatomic, strong) CAShapeLayer *arcLayer; 37 | @property(nonatomic, assign) SSProgressHUDMode mode; 38 | @property(nonatomic, strong) UIBezierPath *aboveBezierPath; 39 | @property(nonatomic, strong) CAShapeLayer *aboveArcLayer; 40 | @property(nonatomic, strong) UILabel *progressLabel; 41 | 42 | @end 43 | 44 | @implementation SSProgressArcView 45 | 46 | - (instancetype)initWithMode:(SSProgressHUDMode)mode { 47 | if (self = [super init]) { 48 | self.mode = mode; 49 | _bezierPath = [UIBezierPath bezierPath]; 50 | _arcLayer = [CAShapeLayer layer]; 51 | _arcLayer.lineWidth = kLineWidth; 52 | _arcLayer.fillColor = [UIColor clearColor].CGColor; 53 | _arcLayer.lineCap = kCALineCapRound; 54 | [self.layer addSublayer:_arcLayer]; 55 | if (mode == SSProgressHUDModeProgressValue) { 56 | _arcLayer.strokeColor = [[UIColor blackColor]colorWithAlphaComponent:0.2].CGColor; 57 | 58 | _aboveBezierPath = [UIBezierPath bezierPath]; 59 | _aboveArcLayer = [CAShapeLayer layer]; 60 | _aboveArcLayer.lineWidth = kLineWidth; 61 | _aboveArcLayer.fillColor = [UIColor clearColor].CGColor; 62 | _aboveArcLayer.strokeColor = [UIColor blackColor].CGColor; 63 | _aboveArcLayer.lineCap = kCALineCapRound; 64 | [self.layer addSublayer:_aboveArcLayer]; 65 | 66 | _progressLabel = [UILabel new]; 67 | _progressLabel.textAlignment = NSTextAlignmentCenter; 68 | _progressLabel.adjustsFontSizeToFitWidth = YES; 69 | [self addSubview:_progressLabel]; 70 | 71 | 72 | 73 | }else{ 74 | _arcLayer.strokeColor = [UIColor blackColor].CGColor; 75 | 76 | _animation1 = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 77 | _animation1.fromValue = @0; 78 | _animation1.toValue = @1; 79 | _animation1.duration = kDuration; 80 | _animation1.repeatCount = 1; 81 | _animation1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 82 | _animation1.removedOnCompletion = NO; 83 | _animation1.fillMode = kCAFillModeBoth; 84 | 85 | _animation2 = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; 86 | _animation2.fromValue = @0; 87 | _animation2.toValue = @1; 88 | _animation2.duration = kDuration; 89 | _animation2.repeatCount = 1; 90 | _animation2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 91 | _animation2.removedOnCompletion = NO; 92 | _animation2.fillMode = kCAFillModeBoth; 93 | } 94 | } 95 | return self; 96 | } 97 | 98 | 99 | - (void)didMoveToSuperview{ 100 | 101 | if (self.mode != SSProgressHUDModeProgressValue) { 102 | [self startAnimated1]; 103 | } 104 | } 105 | 106 | 107 | - (void)layoutSubviews{ 108 | [super layoutSubviews]; 109 | [self.bezierPath removeAllPoints]; 110 | [self.bezierPath addArcWithCenter:CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetHeight(self.frame)/2.f) radius:CGRectGetWidth(self.frame)/2.0 startAngle:-M_PI/2 endAngle:M_PI*1.5 clockwise:YES]; 111 | self.arcLayer.path = self.bezierPath.CGPath; 112 | _progressLabel.frame = CGRectMake(kLineWidth, 0, CGRectGetWidth(self.frame)-kLineWidth*2, CGRectGetHeight(self.frame)-kLineWidth*2); 113 | } 114 | 115 | 116 | - (void)startAnimated1{ 117 | [self.arcLayer removeAllAnimations]; 118 | [self.arcLayer addAnimation:_animation1 forKey:@"strokeEndAnimation"]; 119 | __weak typeof(self) weakSelf = self; 120 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 121 | [weakSelf startAnimated2]; 122 | }); 123 | } 124 | 125 | - (void)startAnimated2{ 126 | 127 | [self.arcLayer removeAllAnimations]; 128 | [self.arcLayer addAnimation:_animation2 forKey:@"strokeStartAnimation"]; 129 | __weak typeof(self) weakSelf = self; 130 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 131 | [weakSelf startAnimated1]; 132 | }); 133 | } 134 | 135 | - (void)setLineColor:(UIColor *)lineColor { 136 | _lineColor = lineColor; 137 | if (self.mode == SSProgressHUDModeProgressValue) { 138 | self.aboveArcLayer.strokeColor = lineColor.CGColor; 139 | self.arcLayer.strokeColor = [lineColor colorWithAlphaComponent:0.2].CGColor; 140 | }else{ 141 | self.arcLayer.strokeColor = lineColor.CGColor; 142 | } 143 | 144 | } 145 | 146 | - (void)setProgress:(CGFloat)progress { 147 | 148 | _progress = progress; 149 | if (_progress>=1) { 150 | _progress = 1; 151 | } 152 | if (_progress<=0) { 153 | _progress = 0; 154 | } 155 | [_aboveBezierPath removeAllPoints]; 156 | [_aboveBezierPath addArcWithCenter:CGPointMake(CGRectGetWidth(self.frame)/2.0, CGRectGetHeight(self.frame)/2.f) radius:CGRectGetWidth(self.frame)/2.0 startAngle:-M_PI/2 endAngle:M_PI*1.5*_progress clockwise:YES]; 157 | _aboveArcLayer.path = _aboveBezierPath.CGPath; 158 | } 159 | 160 | 161 | @end 162 | 163 | 164 | @interface SSProgressCustomView () 165 | 166 | @end 167 | 168 | @implementation SSProgressCustomView 169 | 170 | @end 171 | 172 | 173 | @interface SSProgressLoadTextView () 174 | @property(nonatomic, strong) UILabel *textLabel; 175 | @property(nonatomic, strong) SSProgressArcView *arcView; 176 | @property(nonatomic, assign) SSProgressHUDMode mode; 177 | 178 | @end 179 | 180 | @implementation SSProgressLoadTextView 181 | 182 | - (instancetype)initWithMode:(SSProgressHUDMode)mode { 183 | if (self = [super init]) { 184 | self.mode = mode; 185 | if (mode == SSProgressHUDModeLoadingAndText) { 186 | _arcView = [[SSProgressArcView alloc]initWithMode:mode]; 187 | [self addSubview:_arcView]; 188 | _arcView.translatesAutoresizingMaskIntoConstraints = NO; 189 | 190 | _textLabel = [UILabel new]; 191 | _textLabel.numberOfLines = 0; 192 | _textLabel.textAlignment = NSTextAlignmentCenter; 193 | _textLabel.font = [UIFont systemFontOfSize:kTextLabelFont]; 194 | _textLabel.preferredMaxLayoutWidth = SSProgressHUDTextMaxWidth; 195 | [self addSubview:_textLabel]; 196 | _textLabel.translatesAutoresizingMaskIntoConstraints = NO; 197 | } 198 | if (mode == SSProgressHUDModeLoading) { 199 | _arcView = [[SSProgressArcView alloc]initWithMode:mode]; 200 | [self addSubview:_arcView]; 201 | _arcView.translatesAutoresizingMaskIntoConstraints = NO; 202 | } 203 | if (mode == SSProgressHUDModeText) { 204 | _textLabel = [UILabel new]; 205 | _textLabel.numberOfLines = 0; 206 | _textLabel.textAlignment = NSTextAlignmentCenter; 207 | _textLabel.font = [UIFont systemFontOfSize:kTextLabelFont]; 208 | _textLabel.preferredMaxLayoutWidth = SSProgressHUDTextMaxWidth; 209 | [self addSubview:_textLabel]; 210 | _textLabel.translatesAutoresizingMaskIntoConstraints = NO; 211 | } 212 | 213 | 214 | } 215 | return self; 216 | } 217 | 218 | - (void)updateConstraints { 219 | 220 | 221 | if (self.mode == SSProgressHUDModeText) { 222 | NSLayoutConstraint *textTop = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 223 | NSLayoutConstraint *textleft = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 224 | NSLayoutConstraint *textRight = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 225 | NSLayoutConstraint *textBottom = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 226 | 227 | [self addConstraints:@[textTop,textleft,textRight,textBottom]]; 228 | } 229 | 230 | if (self.mode == SSProgressHUDModeLoadingAndText) { 231 | if (self.text.length) { 232 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 233 | NSLayoutConstraint *loadCenterX = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]; 234 | NSLayoutConstraint *loadWidth = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kTextArcRadius*2]; 235 | NSLayoutConstraint *loadHeight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kTextArcRadius*2]; 236 | [self addConstraints:@[loadTop,loadCenterX,loadWidth,loadHeight]]; 237 | 238 | 239 | NSLayoutConstraint *textTop = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:kTextArcRadius*2 + kLoadAndTextSpace]; 240 | NSLayoutConstraint *textleft = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 241 | NSLayoutConstraint *textRight = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 242 | NSLayoutConstraint *textBottom = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 243 | NSLayoutConstraint *textWidth = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kTextArcRadius*2]; 244 | 245 | [self addConstraints:@[textTop,textleft,textRight,textBottom,textWidth,textWidth]]; 246 | }else { 247 | NSLayoutConstraint *loadWidth = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kArcRadius*2]; 248 | NSLayoutConstraint *loadHeight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kArcRadius*2]; 249 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 250 | NSLayoutConstraint *loadLeft = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 251 | NSLayoutConstraint *loadBottom = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 252 | NSLayoutConstraint *loadRight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 253 | 254 | [self addConstraints:@[loadWidth,loadHeight,loadTop,loadLeft,loadBottom,loadRight]]; 255 | } 256 | } 257 | 258 | if (self.mode == SSProgressHUDModeLoading) { 259 | NSLayoutConstraint *loadWidth = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kArcRadius*2]; 260 | NSLayoutConstraint *loadHeight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kArcRadius*2]; 261 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 262 | NSLayoutConstraint *loadLeft = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 263 | NSLayoutConstraint *loadBottom = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 264 | NSLayoutConstraint *loadRight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 265 | 266 | [self addConstraints:@[loadWidth,loadHeight,loadTop,loadLeft,loadBottom,loadRight]]; 267 | } 268 | 269 | 270 | [super updateConstraints]; 271 | 272 | } 273 | 274 | - (void)setText:(NSString *)text 275 | { 276 | [super setText:text]; 277 | _textLabel.text = text; 278 | [self setNeedsUpdateConstraints]; 279 | } 280 | 281 | - (void)setTextColor:(UIColor *)textColor 282 | { 283 | [super setTextColor:textColor]; 284 | _textLabel.textColor = textColor; 285 | } 286 | 287 | - (void)setContentColor:(UIColor *)contentColor { 288 | [super setContentColor:contentColor]; 289 | _textLabel.textColor = contentColor; 290 | _arcView.lineColor = contentColor; 291 | _arcView.progressLabel.textColor = contentColor; 292 | } 293 | 294 | - (void)setTextFont:(UIFont *)textFont { 295 | [super setTextFont:textFont]; 296 | _textLabel.font = textFont; 297 | } 298 | 299 | @end 300 | 301 | 302 | @interface SSProgressValueView () 303 | @property(nonatomic, strong) UILabel *textLabel; 304 | @property(nonatomic, strong) SSProgressArcView *arcView; 305 | @end 306 | 307 | @implementation SSProgressValueView 308 | 309 | - (instancetype)initWithFrame:(CGRect)frame 310 | { 311 | self = [super initWithFrame:frame]; 312 | if (self) { 313 | _arcView = [[SSProgressArcView alloc]initWithMode:SSProgressHUDModeProgressValue]; 314 | [self addSubview:_arcView]; 315 | _arcView.translatesAutoresizingMaskIntoConstraints = NO; 316 | 317 | _textLabel = [UILabel new]; 318 | _textLabel.numberOfLines = 0; 319 | _textLabel.textAlignment = NSTextAlignmentCenter; 320 | _textLabel.font = [UIFont systemFontOfSize:kTextLabelFont]; 321 | _textLabel.preferredMaxLayoutWidth = SSProgressHUDTextMaxWidth; 322 | [self addSubview:_textLabel]; 323 | _textLabel.translatesAutoresizingMaskIntoConstraints = NO; 324 | } 325 | return self; 326 | } 327 | 328 | - (void)setProgress:(CGFloat)progress { 329 | _progress = progress; 330 | if (_progress>=1) { 331 | _progress = 1; 332 | } 333 | if (_progress<=0) { 334 | _progress = 0; 335 | } 336 | _arcView.progress = _progress; 337 | _arcView.progressLabel.text = [NSString stringWithFormat:@"%.f%%",_progress*100]; 338 | } 339 | 340 | - (void)updateConstraints { 341 | if (self.text.length) { 342 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 343 | NSLayoutConstraint *loadCenterX = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]; 344 | NSLayoutConstraint *loadWidth = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kTextArcRadius*2]; 345 | NSLayoutConstraint *loadHeight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kTextArcRadius*2]; 346 | [self addConstraints:@[loadTop,loadCenterX,loadWidth,loadHeight]]; 347 | 348 | 349 | NSLayoutConstraint *textTop = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:kTextArcRadius*2 + kLoadAndTextSpace]; 350 | NSLayoutConstraint *textleft = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 351 | NSLayoutConstraint *textRight = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 352 | NSLayoutConstraint *textBottom = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 353 | NSLayoutConstraint *textWidth = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kTextArcRadius*2]; 354 | 355 | [self addConstraints:@[textTop,textleft,textRight,textBottom,textWidth,textWidth]]; 356 | }else { 357 | NSLayoutConstraint *loadWidth = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kArcRadius*2]; 358 | NSLayoutConstraint *loadHeight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:kArcRadius*2]; 359 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 360 | NSLayoutConstraint *loadLeft = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 361 | NSLayoutConstraint *loadBottom = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 362 | NSLayoutConstraint *loadRight = [NSLayoutConstraint constraintWithItem:self.arcView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 363 | 364 | [self addConstraints:@[loadWidth,loadHeight,loadTop,loadLeft,loadBottom,loadRight]]; 365 | } 366 | [super updateConstraints]; 367 | } 368 | 369 | - (void)setText:(NSString *)text 370 | { 371 | [super setText:text]; 372 | _textLabel.text = text; 373 | [self setNeedsUpdateConstraints]; 374 | } 375 | 376 | - (void)setTextColor:(UIColor *)textColor 377 | { 378 | [super setTextColor:textColor]; 379 | _textLabel.textColor = textColor; 380 | } 381 | 382 | - (void)setContentColor:(UIColor *)contentColor { 383 | [super setContentColor:contentColor]; 384 | _textLabel.textColor = contentColor; 385 | _arcView.lineColor = contentColor; 386 | } 387 | 388 | - (void)setTextFont:(UIFont *)textFont { 389 | [super setTextFont:textFont]; 390 | _textLabel.font = textFont; 391 | } 392 | 393 | 394 | 395 | @end 396 | 397 | 398 | @interface SSProgressImageView () 399 | @property (nonatomic, strong) UIImageView *imageView; 400 | @property(nonatomic, strong) UILabel *textLabel; 401 | 402 | @end 403 | 404 | 405 | @implementation SSProgressImageView 406 | 407 | - (instancetype)initWithFrame:(CGRect)frame 408 | { 409 | self = [super initWithFrame:frame]; 410 | if (self) { 411 | _imageView = [[UIImageView alloc]init]; 412 | [self addSubview:_imageView]; 413 | _imageView.translatesAutoresizingMaskIntoConstraints = NO; 414 | 415 | _textLabel = [UILabel new]; 416 | _textLabel.numberOfLines = 0; 417 | _textLabel.textAlignment = NSTextAlignmentCenter; 418 | _textLabel.font = [UIFont systemFontOfSize:kTextLabelFont]; 419 | _textLabel.preferredMaxLayoutWidth = SSProgressHUDTextMaxWidth; 420 | [self addSubview:_textLabel]; 421 | _textLabel.translatesAutoresizingMaskIntoConstraints = NO; 422 | } 423 | return self; 424 | } 425 | 426 | - (void)setImage:(UIImage *)image { 427 | _imageView.image = image; 428 | [self setNeedsUpdateConstraints]; 429 | } 430 | 431 | - (void)updateConstraints { 432 | if (self.text.length) { 433 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:_imageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 434 | NSLayoutConstraint *loadCenterX = [NSLayoutConstraint constraintWithItem:_imageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]; 435 | CGFloat arcRadius = kArcRadius*0.7; 436 | // NSLayoutConstraint *loadWidth = [NSLayoutConstraint constraintWithItem:_imageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:arcRadius*2]; 437 | // NSLayoutConstraint *loadHeight = [NSLayoutConstraint constraintWithItem:_imageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:arcRadius*2]; 438 | [self addConstraints:@[loadTop,loadCenterX]]; 439 | 440 | 441 | NSLayoutConstraint *textTop = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.imageView attribute:NSLayoutAttributeBottom multiplier:1 constant:kLoadAndTextSpace]; 442 | NSLayoutConstraint *textleft = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 443 | NSLayoutConstraint *textRight = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 444 | NSLayoutConstraint *textBottom = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 445 | NSLayoutConstraint *textWidth = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:arcRadius*2]; 446 | 447 | [self addConstraints:@[textTop,textleft,textRight,textBottom,textWidth,textWidth]]; 448 | }else { 449 | 450 | NSLayoutConstraint *loadTop = [NSLayoutConstraint constraintWithItem:self.imageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0]; 451 | NSLayoutConstraint *loadLeft = [NSLayoutConstraint constraintWithItem:self.imageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; 452 | NSLayoutConstraint *loadBottom = [NSLayoutConstraint constraintWithItem:self.imageView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0]; 453 | NSLayoutConstraint *loadRight = [NSLayoutConstraint constraintWithItem:self.imageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0]; 454 | 455 | [self addConstraints:@[loadTop,loadLeft,loadBottom,loadRight]]; 456 | } 457 | [super updateConstraints]; 458 | } 459 | 460 | - (void)setText:(NSString *)text 461 | { 462 | [super setText:text]; 463 | _textLabel.text = text; 464 | [self setNeedsUpdateConstraints]; 465 | } 466 | 467 | - (void)setTextColor:(UIColor *)textColor 468 | { 469 | [super setTextColor:textColor]; 470 | _textLabel.textColor = textColor; 471 | } 472 | 473 | - (void)setContentColor:(UIColor *)contentColor { 474 | [super setContentColor:contentColor]; 475 | _textLabel.textColor = contentColor; 476 | } 477 | 478 | - (void)setTextFont:(UIFont *)textFont { 479 | [super setTextFont:textFont]; 480 | _textLabel.font = textFont; 481 | } 482 | @end 483 | 484 | 485 | 486 | @interface SSProgressHUD() 487 | 488 | @property(nonatomic, assign) SSProgressHUDMode mode; 489 | @property(nonatomic, strong) UIView *customView; 490 | @property(nonatomic, strong) UIView *maskView; 491 | 492 | @end 493 | 494 | @implementation SSProgressHUD 495 | 496 | - (instancetype)initWithFrame:(CGRect)frame{ 497 | if (self = [super initWithFrame:frame]) { 498 | self.backgroundColor = [UIColor whiteColor]; 499 | self.layer.cornerRadius = 5; 500 | self.customViewEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10); 501 | self.translatesAutoresizingMaskIntoConstraints = NO; 502 | 503 | } 504 | return self; 505 | } 506 | 507 | - (instancetype)initWithCustomView:(UIView *)customView{ 508 | NSAssert(customView, @"customView不为nil"); 509 | if (self = [self initWithFrame:CGRectZero]) { 510 | self.customView = customView; 511 | self.customView.translatesAutoresizingMaskIntoConstraints = NO; 512 | [self addSubview:self.customView]; 513 | } 514 | return self; 515 | } 516 | 517 | - (instancetype)initWithMode:(SSProgressHUDMode)mode{ 518 | self.mode = mode; 519 | UIView *tempView; 520 | 521 | if (mode == SSProgressHUDModeLoading) { 522 | tempView = [[SSProgressLoadTextView alloc]initWithMode:SSProgressHUDModeLoading]; 523 | } 524 | 525 | if (mode == SSProgressHUDModeLoadingAndText) { 526 | tempView = [[SSProgressLoadTextView alloc]initWithMode:SSProgressHUDModeLoadingAndText]; 527 | } 528 | 529 | if (mode == SSProgressHUDModeText) { 530 | tempView = [[SSProgressLoadTextView alloc]initWithMode:SSProgressHUDModeText]; 531 | 532 | } 533 | if (mode == SSProgressHUDModeProgressValue) { 534 | tempView = [[SSProgressValueView alloc]initWithFrame:CGRectZero]; 535 | } 536 | if (mode == SSProgressHUDModeImage) { 537 | tempView = [[SSProgressImageView alloc]initWithFrame:CGRectZero]; 538 | } 539 | 540 | self = [self initWithCustomView:tempView]; 541 | 542 | return self; 543 | } 544 | 545 | 546 | - (void)updateConstraints { 547 | 548 | 549 | NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:self.customView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:self.customViewEdgeInsets.top]; 550 | NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem:self.customView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:self.customViewEdgeInsets.left]; 551 | NSLayoutConstraint *bottom = [NSLayoutConstraint constraintWithItem:self.customView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:-self.customViewEdgeInsets.bottom]; 552 | NSLayoutConstraint *right = [NSLayoutConstraint constraintWithItem:self.customView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:-self.customViewEdgeInsets.right]; 553 | if (self.customView.frame.size.width &&self.customView.frame.size.height) { 554 | NSLayoutConstraint *width = [NSLayoutConstraint constraintWithItem:self.customView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:self.customView.frame.size.width]; 555 | NSLayoutConstraint *height = [NSLayoutConstraint constraintWithItem:self.customView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:self.customView.frame.size.height]; 556 | [self addConstraint:width]; 557 | [self addConstraint:height]; 558 | 559 | } 560 | [self addConstraints:@[top,left,bottom,right]]; 561 | 562 | 563 | NSLayoutConstraint *selfCenterX = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.superview attribute:NSLayoutAttributeCenterX multiplier:1 constant:self.viewCenterOffet.x]; 564 | NSLayoutConstraint *selfCenterY = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.superview attribute:NSLayoutAttributeCenterY multiplier:1 constant:self.viewCenterOffet.y]; 565 | [self.superview addConstraints:@[selfCenterX,selfCenterY]]; 566 | 567 | 568 | 569 | [super updateConstraints]; 570 | } 571 | - (void)layoutSubviews { 572 | [super layoutSubviews]; 573 | self.maskView.frame = CGRectMake(0, 0, CGRectGetWidth(self.maskView.superview.frame), CGRectGetHeight(self.maskView.superview.frame)); 574 | CGRect selfFrame = self.frame; 575 | CGSize selfSize = selfFrame.size; 576 | selfSize.width = CGRectGetWidth(self.customView.frame)+self.customViewEdgeInsets.left+self.customViewEdgeInsets.right; 577 | selfSize.height = CGRectGetHeight(self.customView.frame)+self.customViewEdgeInsets.top+self.customViewEdgeInsets.bottom; 578 | selfFrame.size = selfSize; 579 | self.frame = selfFrame; 580 | } 581 | 582 | - (void)showOnView:(UIView *)view animated:(BOOL)animated{ 583 | 584 | [self showOnView:view animated:animated maskType:SSProgressHUDMaskTypeNone]; 585 | 586 | } 587 | 588 | - (void)showOnView:(UIView *)view animated:(BOOL)animated maskType:(SSProgressHUDMaskType)maskType { 589 | NSAssert(view, @"superView不为nil"); 590 | if (maskType != SSProgressHUDMaskTypeNone) { 591 | self.maskView = [UIView new]; 592 | if (maskType == SSProgressHUDMaskTypeBlack) { 593 | self.maskView.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.1]; 594 | } 595 | [view addSubview:self.maskView]; 596 | } 597 | 598 | 599 | [view addSubview:self]; 600 | [self setNeedsUpdateConstraints]; 601 | if (animated) { 602 | self.alpha = 0.f; 603 | [UIView animateWithDuration:0.3 animations:^{ 604 | self.alpha = 1.0f; 605 | } completion:^(BOOL finished) { 606 | 607 | }]; 608 | } 609 | } 610 | 611 | - (void)hideViewAnimated:(BOOL)animated{ 612 | [self hideViewAnimated:animated completion:nil]; 613 | 614 | } 615 | - (void)hideViewAnimated:(BOOL)animated completion:(void (^ __nullable)(void))completion { 616 | if (animated) { 617 | [UIView animateWithDuration:0.2 animations:^{ 618 | self.alpha = 0.0f; 619 | if (self.maskView) { 620 | self.maskView.alpha = 0.0; 621 | } 622 | } completion:^(BOOL finished) { 623 | !completion?:completion(); 624 | [self removeFromSuperview]; 625 | if (self.maskView) { 626 | [self.maskView removeFromSuperview]; 627 | } 628 | }]; 629 | }else{ 630 | !completion?:completion(); 631 | [self removeFromSuperview]; 632 | if (self.maskView) { 633 | [self.maskView removeFromSuperview]; 634 | } 635 | } 636 | } 637 | 638 | - (void)setCustomProgress:(CGFloat)customProgress finished:(void (^__nullable)(void))finished { 639 | self.customProgress = customProgress; 640 | if (customProgress>=1) { 641 | !finished?:finished(); 642 | } 643 | } 644 | 645 | 646 | - (SSProgressCustomView *)getCustomView{ 647 | 648 | if ([self.customView isKindOfClass:SSProgressCustomView.class]) { 649 | SSProgressCustomView *view = (SSProgressCustomView *)self.customView; 650 | return view; 651 | } 652 | return nil; 653 | } 654 | 655 | 656 | 657 | 658 | #pragma mark - Property 659 | 660 | 661 | 662 | - (void)setViewCenterOffet:(CGPoint)viewCenterOffet{ 663 | _viewCenterOffet = viewCenterOffet; 664 | [self setNeedsUpdateConstraints]; 665 | } 666 | 667 | - (void)setCustomViewEdgeInsets:(UIEdgeInsets)customViewEdgeInsets{ 668 | _customViewEdgeInsets = customViewEdgeInsets; 669 | [self setNeedsUpdateConstraints]; 670 | } 671 | 672 | - (void)setCustomContentColor:(UIColor *)customContentColor { 673 | [self getCustomView].contentColor = customContentColor; 674 | } 675 | - (void)setCustomText:(NSString *)customText { 676 | [self getCustomView].text = customText; 677 | } 678 | - (void)setCustomTextColor:(UIColor *)customTextColor { 679 | [self getCustomView].textColor = customTextColor; 680 | } 681 | - (void)setCustomTextFont:(UIFont *)customTextFont { 682 | [self getCustomView].textFont = customTextFont; 683 | } 684 | 685 | - (void)setCustomProgress:(CGFloat)customProgress { 686 | if (self.mode == SSProgressHUDModeProgressValue&&self.customView) { 687 | SSProgressValueView *view = (SSProgressValueView *)self.customView; 688 | view.progress = customProgress; 689 | } 690 | } 691 | - (void)setCustomImage:(UIImage *)customImage { 692 | if (self.mode == SSProgressHUDModeImage&&self.customView&&customImage) { 693 | SSProgressImageView *view = (SSProgressImageView *)self.customView; 694 | view.image = customImage; 695 | } 696 | } 697 | 698 | - (void)setColorType:(SSProgressHUDColorType)colorType { 699 | if (colorType == SSProgressHUDColorTypeBlack) { 700 | [self getCustomView].contentColor = [UIColor whiteColor]; 701 | self.backgroundColor = [UIColor blackColor]; 702 | } 703 | } 704 | 705 | @end 706 | 707 | 708 | 709 | @implementation NSObject (SSProgressHUD) 710 | 711 | - (NSMutableDictionary *)hudDict { 712 | 713 | if (!objc_getAssociatedObject(self, _cmd)) { 714 | objc_setAssociatedObject(self, _cmd, @{}.mutableCopy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 715 | } 716 | return objc_getAssociatedObject(self, _cmd); 717 | } 718 | 719 | 720 | #pragma mark - show loading 721 | - (void)showLoading { 722 | [self showLoadingWithTag:-1]; 723 | } 724 | 725 | - (void)showLoadingWithMaskType:(SSProgressHUDMaskType)maskType { 726 | [self showLoadingWithTag:-1 maskType:maskType]; 727 | } 728 | 729 | - (void)showLoadingWithTag:(NSInteger)tag { 730 | [self showLoadingWithTag:tag maskType:SSProgressHUDMaskTypeNone]; 731 | } 732 | - (void)showLoadingWithTag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType { 733 | [self showHUDWithMode:SSProgressHUDModeLoading text:nil tag:tag maskType:maskType]; 734 | } 735 | 736 | - (void)showLoadingText:( NSString *)text { 737 | [self showLoadingText:text tag:-1]; 738 | } 739 | - (void)showLoadingText:(NSString * _Nullable )text maskType:(SSProgressHUDMaskType)maskType{ 740 | [self showLoadingText:text tag:-1 maskType:maskType]; 741 | } 742 | 743 | - (void)showLoadingText:( NSString *)text tag:(NSInteger)tag { 744 | 745 | [self showLoadingText:text tag:tag maskType:SSProgressHUDMaskTypeNone]; 746 | } 747 | - (void)showLoadingText:(NSString *)text tag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType { 748 | [self showHUDWithMode:SSProgressHUDModeLoadingAndText text:text tag:tag maskType:maskType]; 749 | } 750 | 751 | #pragma mark - show text 752 | - (void)showText:(NSString *)text { 753 | 754 | [self showText:text finished:nil]; 755 | 756 | } 757 | - (void)showText:(NSString *)text finished:(void (^ __nullable)(void))finished { 758 | [self showText:text maskType:SSProgressHUDMaskTypeNone finished:finished]; 759 | } 760 | 761 | - (void)showText:(NSString *)text maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished { 762 | SSProgressHUD *hud = [self showHUDWithMode:SSProgressHUDModeText text:text tag:0 maskType:maskType]; 763 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 764 | [hud hideViewAnimated:YES completion:finished]; 765 | }); 766 | } 767 | 768 | #pragma mark - progress 769 | 770 | - (void)showProgress:(CGFloat)progress finished:(void (^ __nullable)(void))finished { 771 | [self showProgress:progress text:nil maskType:SSProgressHUDMaskTypeNone finished:finished]; 772 | } 773 | - (void)showProgress:(CGFloat)progress maskType:(SSProgressHUDMaskType)maskType finished:(void(^ __nullable)(void))finished { 774 | [self showProgress:progress text:nil maskType:maskType finished:finished]; 775 | } 776 | 777 | - (void)showProgress:(CGFloat)progress text:(NSString *)text finished:(void (^ __nullable)(void))finished { 778 | [self showProgress:progress text:text maskType:SSProgressHUDMaskTypeNone finished:finished]; 779 | } 780 | 781 | - (void)showProgress:(CGFloat)progress text:(NSString * _Nullable)text maskType:(SSProgressHUDMaskType)maskType finished:(void (^ _Nullable)(void))finished { 782 | SSProgressHUD *hud = [self progressValueHUDWithMaskType:maskType]; 783 | hud.customText = text; 784 | __weak SSProgressHUD *weakHud = hud; 785 | [hud setCustomProgress:progress finished:^{ 786 | [weakHud hideViewAnimated:YES completion:^{ 787 | !finished?:finished(); 788 | objc_setAssociatedObject(self, @selector(progressValueHUDWithMaskType:), nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 789 | }]; 790 | }]; 791 | } 792 | 793 | #pragma mark - image 794 | 795 | - (void)showHUDWithImageName:(NSString *)imageName { 796 | [self showHUDWithImageName:imageName text:nil]; 797 | } 798 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString *)text { 799 | [self showHUDWithImageName:imageName text:text finished:nil]; 800 | } 801 | 802 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString *)text finished:( void(^ __nullable)(void))finished { 803 | 804 | [self showHUDWithImageName:imageName text:text maskType:SSProgressHUDMaskTypeNone finished:finished]; 805 | } 806 | - (void)showHUDWithImageName:(NSString *)imageName text:(NSString *)text maskType:(SSProgressHUDMaskType)maskType finished:(void (^ _Nullable)(void))finished { 807 | SSProgressHUD *hud = [self showHUDWithMode:SSProgressHUDModeImage text:text tag:0 maskType:maskType]; 808 | hud.customImage = [UIImage imageNamed:imageName]; 809 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 810 | [hud hideViewAnimated:YES completion:finished]; 811 | }); 812 | } 813 | 814 | #pragma mark - hide 815 | - (void)hideHUD { 816 | [self hideHUDAnimated:YES tag:-1]; 817 | } 818 | - (void)hideHUDWithTag:(NSInteger)tag { 819 | [self hideHUDAnimated:YES tag:tag finished:nil]; 820 | } 821 | - (void)hideHUDAnimated:(BOOL)animated { 822 | [self hideHUDAnimated:animated finished:nil]; 823 | } 824 | - (void)hideHUDAnimated:(BOOL)animated tag:(NSInteger)tag { 825 | [self hideHUDAnimated:animated tag:tag finished:nil]; 826 | 827 | } 828 | - (void)hideHUDAnimated:(BOOL)animated finished:(void(^ __nullable)(void))finished { 829 | [self hideHUDAnimated:animated tag:-1 finished:finished]; 830 | } 831 | - (void)hideHUDAnimated:(BOOL)animated tag:(NSInteger)tag finished:(void (^ __nullable)(void))finished { 832 | SSProgressHUD *hud = [[self hudDict]objectForKey:[NSString stringWithFormat:@"%ld",tag]]; 833 | [hud hideViewAnimated:animated completion:finished]; 834 | } 835 | 836 | #pragma mark - method 837 | 838 | - (SSProgressHUD *)showHUDWithMode:(SSProgressHUDMode)mode text:(NSString *)text tag:(NSInteger)tag maskType:(SSProgressHUDMaskType)maskType{ 839 | if (![self getSuperView]) return nil; 840 | SSProgressHUD *hud = [[SSProgressHUD alloc]initWithMode:mode]; 841 | // hud.colorType = SSProgressHUDColorTypeBlack; 842 | hud.customText = text; 843 | [hud showOnView:[self getSuperView] animated:YES maskType:maskType]; 844 | NSString *tagKey = [NSString stringWithFormat:@"%ld",tag]; 845 | ///如果已存在相同的就删除 846 | 847 | if (tag>0||tag==-1) { 848 | if ([[[self hudDict]allKeys]containsObject:tagKey]) { 849 | SSProgressHUD *t = [[self hudDict]objectForKey:tagKey]; 850 | [t hideViewAnimated:NO]; 851 | [[self hudDict]removeObjectForKey:tagKey]; 852 | } 853 | [[self hudDict]setObject:hud forKey:[NSString stringWithFormat:@"%ld",tag]]; 854 | } 855 | 856 | return hud; 857 | } 858 | 859 | - (SSProgressHUD *)progressValueHUDWithMaskType:(SSProgressHUDMaskType)maskType { 860 | if (!objc_getAssociatedObject(self, _cmd)) { 861 | SSProgressHUD *hud = [[SSProgressHUD alloc]initWithMode:SSProgressHUDModeProgressValue]; 862 | [hud showOnView:[self getSuperView] animated:YES maskType:maskType]; 863 | objc_setAssociatedObject(self, _cmd, hud, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 864 | } 865 | 866 | return objc_getAssociatedObject(self, _cmd); 867 | } 868 | 869 | 870 | 871 | - (UIView *)getSuperView 872 | { 873 | if ([self isKindOfClass:[UIView class]]) { 874 | return (UIView *)self; 875 | }else if ([self isKindOfClass:[UIViewController class]]){ 876 | return [(UIViewController *)self view]; 877 | }else if([UIApplication sharedApplication].keyWindow){ 878 | return [UIApplication sharedApplication].keyWindow; 879 | } 880 | return nil; 881 | } 882 | 883 | @end 884 | -------------------------------------------------------------------------------- /SSProgressHUD/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SSProgressHUD/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SSProgressHUD.h" 11 | 12 | 13 | @interface CustomView : SSProgressCustomView 14 | 15 | @end 16 | 17 | 18 | @implementation CustomView 19 | 20 | 21 | 22 | @end 23 | 24 | 25 | @interface ViewController () 26 | { 27 | NSMutableArray *_cellTexts; 28 | NSMutableArray *_cellTitleTexts; 29 | 30 | NSTimer *_timer; 31 | 32 | } 33 | @end 34 | 35 | @implementation ViewController 36 | 37 | 38 | - (void)viewDidLoad { 39 | [super viewDidLoad]; 40 | self.navigationItem.title = @"SSProgressHUD"; 41 | UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)) style:UITableViewStyleGrouped]; 42 | tableView.delegate = self; 43 | tableView.dataSource = self; 44 | [self.view addSubview:tableView]; 45 | 46 | _cellTexts = @[@[@[@"没有文字",NSStringFromSelector(@selector(showLoad))], 47 | @[@"有文字",NSStringFromSelector(@selector(showLoadText))], 48 | @[@"有文字,有背景图层",NSStringFromSelector(@selector(showLoadWithMask))], 49 | @[@"多个loading同时出现时,通过标记 tag移除",NSStringFromSelector(@selector(showLoadWithTag))]], 50 | @[@[@"文字提示",NSStringFromSelector(@selector(showText))], 51 | @[@"文字提示,消失回调",NSStringFromSelector(@selector(showTextHasFinish))], 52 | @[@"文字提示,有背景图层",NSStringFromSelector(@selector(showTextHasMask))] 53 | ], 54 | @[@[@"有文字",NSStringFromSelector(@selector(showImage))], 55 | @[@"没有文字",NSStringFromSelector(@selector(showImage1))]], 56 | @[@[@"有文字",NSStringFromSelector(@selector(showProgressValue))], 57 | @[@"没有文字",NSStringFromSelector(@selector(showProgressValue1))]], 58 | @[@[@"自定义一个视图",NSStringFromSelector(@selector(showCustom))]] 59 | ] 60 | .mutableCopy; 61 | 62 | _cellTitleTexts = @[@"loading+文字",@"文字提示",@"图标+文字",@"进度",@"自定义视图"].mutableCopy; 63 | // Do any additional setup after loading the view, typically from a nib. 64 | } 65 | 66 | 67 | - (void)showLoad{ 68 | 69 | [self showLoading]; 70 | __weak typeof(self) weakSelf = self; 71 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 72 | [weakSelf hideHUD]; 73 | }); 74 | } 75 | 76 | - (void)showLoadWithMask{ 77 | [self showLoadingWithMaskType:SSProgressHUDMaskTypeBlack]; 78 | __weak typeof(self) weakSelf = self; 79 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 80 | [weakSelf hideHUD]; 81 | }); 82 | } 83 | - (void)showLoadText{ 84 | [self showLoadingText:@"正在加载"]; 85 | __weak typeof(self) weakSelf = self; 86 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 87 | [weakSelf hideHUD]; 88 | }); 89 | } 90 | 91 | - (void)showLoadWithTag { 92 | for (NSInteger i=1; i<4; i++) { 93 | [self showLoadingWithTag:i]; 94 | __weak typeof(self) weakSelf = self; 95 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 96 | [weakSelf hideHUDWithTag:i]; 97 | }); 98 | } 99 | 100 | } 101 | 102 | - (void)showText{ 103 | 104 | [self showText:@"提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示"]; 105 | } 106 | - (void)showTextHasMask{ 107 | 108 | [self showText:@"提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示" maskType:SSProgressHUDMaskTypeBlack finished:nil]; 109 | } 110 | 111 | - (void)showTextHasFinish{ 112 | __weak typeof(self) weakSelf = self; 113 | [self showText:@"提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示提示" finished:^{ 114 | [weakSelf showText:@"消失时的回调"]; 115 | }]; 116 | } 117 | 118 | - (void)showImage{ 119 | [self showHUDWithImageName:@"sq_success" text:@"操作成功"]; 120 | } 121 | 122 | - (void)showImage1{ 123 | [self showHUDWithImageName:@"sq_success" text:nil]; 124 | } 125 | 126 | - (void)showProgressValue { 127 | 128 | 129 | if (_timer) { 130 | return; 131 | } 132 | 133 | __block CGFloat progress = 0; 134 | _timer = [NSTimer timerWithTimeInterval:0.1 repeats:YES block:^(NSTimer * _Nonnull timer) { 135 | progress += 0.01; 136 | [self showProgress:progress text:@"正在下载" finished:^{ 137 | [timer invalidate]; 138 | self->_timer = nil; 139 | }]; 140 | 141 | }]; 142 | [[NSRunLoop mainRunLoop]addTimer:_timer forMode:NSRunLoopCommonModes]; 143 | } 144 | 145 | - (void)showProgressValue1{ 146 | if (_timer) { 147 | return; 148 | } 149 | 150 | __block CGFloat progress = 0; 151 | _timer = [NSTimer timerWithTimeInterval:0.1 repeats:YES block:^(NSTimer * _Nonnull timer) { 152 | progress += 0.01; 153 | [self showProgress:progress text:nil finished:^{ 154 | [timer invalidate]; 155 | self->_timer = nil; 156 | }]; 157 | 158 | }]; 159 | [[NSRunLoop mainRunLoop]addTimer:_timer forMode:NSRunLoopCommonModes]; 160 | } 161 | 162 | - (void)showCustom{ 163 | 164 | UIView *customView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 90, 200)]; 165 | customView.backgroundColor = [UIColor redColor]; 166 | 167 | SSProgressHUD *hud = [[SSProgressHUD alloc]initWithCustomView:customView]; 168 | [hud showOnView:self.view animated:YES]; 169 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 170 | [hud hideViewAnimated:YES]; 171 | }); 172 | } 173 | 174 | 175 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 176 | static NSString *identifier = @"Cell"; 177 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 178 | if (!cell) { 179 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 180 | } 181 | cell.textLabel.text = _cellTexts[indexPath.section][indexPath.row][0]; 182 | 183 | return cell; 184 | 185 | } 186 | 187 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 188 | return [_cellTexts[section]count]; 189 | } 190 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 191 | return _cellTexts.count;; 192 | } 193 | 194 | 195 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 196 | return 50; 197 | } 198 | 199 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 200 | return _cellTitleTexts[section]; 201 | } 202 | 203 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 204 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 205 | SEL seletor = NSSelectorFromString(_cellTexts[indexPath.section][indexPath.row][1]); 206 | 207 | [self performSelector:seletor withObject:nil afterDelay:0]; 208 | } 209 | 210 | 211 | 212 | @end 213 | 214 | -------------------------------------------------------------------------------- /SSProgressHUD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SSProgressHUD 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. 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 | -------------------------------------------------------------------------------- /SSProgressHUDTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SSProgressHUDTests/SSProgressHUDTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSProgressHUDTests.m 3 | // SSProgressHUDTests 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSProgressHUDTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SSProgressHUDTests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /SSProgressHUDUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SSProgressHUDUITests/SSProgressHUDUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSProgressHUDUITests.m 3 | // SSProgressHUDUITests 4 | // 5 | // Created by Shuqy on 2018/12/28. 6 | // Copyright © 2018 Shuqy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSProgressHUDUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SSProgressHUDUITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 24 | [[[XCUIApplication alloc] init] launch]; 25 | 26 | // 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. 27 | } 28 | 29 | - (void)tearDown { 30 | // Put teardown code here. This method is called after the invocation of each test method in the class. 31 | } 32 | 33 | - (void)testExample { 34 | // Use recording to get started writing UI tests. 35 | // Use XCTAssert and related functions to verify your tests produce the correct results. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /loadingGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/loadingGif.gif -------------------------------------------------------------------------------- /progressGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/progressGif.gif -------------------------------------------------------------------------------- /showImage.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/showImage.gif -------------------------------------------------------------------------------- /showTextGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/namesubai/SSProgressHUD/5393468f12f76a0a3d6fa084fa0968f225885122/showTextGif.gif --------------------------------------------------------------------------------