资源简介
对于swift4.2的网络请求的封装。包含链式,类AFN及对moya的封装。封装的功能包含:1.一次性处理请求指示器HUD
2.一次性处理请求状态码及错误弹窗
3.登录过期自动跳转到登录页等。
4.可以处理所有接口都要使用的公共参数。
代码片段和文件信息
//
// MBProgressHUD.m
// Version 1.1.0
// Created by Matej Bukovinski on 2.4.09.
//
#import “MBProgressHUD.h“
#import
#ifndef kCFCoreFoundationVersionNumber_iOS_7_0
#define kCFCoreFoundationVersionNumber_iOS_7_0 847.20
#endif
#ifndef kCFCoreFoundationVersionNumber_iOS_8_0
#define kCFCoreFoundationVersionNumber_iOS_8_0 1129.15
#endif
#define MBMainThreadAssert() NSAssert([NSThread isMainThread] @“MBProgressHUD needs to be accessed on the main thread.“);
CGFloat const MBProgressMaxOffset = 1000000.f;
static const CGFloat MBDefaultPadding = 4.f;
static const CGFloat MBDefaultLabelFontSize = 16.f;
static const CGFloat MBDefaultDetailsLabelFontSize = 12.f;
@interface MBProgressHUD () {
// Deprecated
UIColor *_activityIndicatorColor;
CGFloat _opacity;
}
@property (nonatomic assign) BOOL useAnimation;
@property (nonatomic assign getter=hasFinished) BOOL finished;
@property (nonatomic strong) UIView *indicator;
@property (nonatomic strong) NSDate *showStarted;
@property (nonatomic strong) NSArray *paddingConstraints;
@property (nonatomic strong) NSArray *bezelConstraints;
@property (nonatomic strong) UIView *topSpacer;
@property (nonatomic strong) UIView *bottomSpacer;
@property (nonatomic weak) NSTimer *graceTimer;
@property (nonatomic weak) NSTimer *minShowTimer;
@property (nonatomic weak) NSTimer *hideDelayTimer;
@property (nonatomic weak) CADisplaylink *progressobjectDisplaylink;
// Deprecated
@property (assign) BOOL taskInProgress;
@end
@interface MBProgressHUDRoundedButton : UIButton
@end
@implementation MBProgressHUD
#pragma mark - Class methods
+ (instancetype)showHUDAddedTo:(UIView *)view animated:(BOOL)animated {
MBProgressHUD *hud = [[self alloc] initWithView:view];
hud.removeFromSuperViewOnHide = YES;
[view addSubview:hud];
[hud showAnimated:animated];
return hud;
}
+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated {
MBProgressHUD *hud = [self HUDForView:view];
if (hud != nil) {
hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:animated];
return YES;
}
return NO;
}
+ (MBProgressHUD *)HUDForView:(UIView *)view {
NSEnumerator *subviewsEnum = [view.subviews reverseobjectEnumerator];
for (UIView *subview in subviewsEnum) {
if ([subview isKindOfClass:self]) {
MBProgressHUD *hud = (MBProgressHUD *)subview;
if (hud.hasFinished == NO) {
return hud;
}
}
}
return nil;
}
#pragma mark - Lifecycle
- (void)commonInit {
// Set default values for properties
_animationType = MBProgressHUDAnimationFade;
_mode = MBProgressHUDModeIndeterminate;
_margin = 20.0f;
_opacity = 1.f;
_defaultMotionEffectsEnabled = YES;
// Default color depending on the current iOS version
BOOL isLegacy = kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0;
_contentColor = isLegacy ? [UIColor whiteColor] :
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\
文件 6148 2018-12-25 09:06 SwiftHttpRequest-master\.DS_Store
文件 65 2018-12-25 09:06 SwiftHttpRequest-master\.gitattributes
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\
文件 32164 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\project.pbxproj
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\project.xcworkspace\
文件 156 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\project.xcworkspace\contents.xcworkspacedata
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\project.xcworkspace\xcuserdata\
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\project.xcworkspace\xcuserdata\yijin.xcuserdatad\
文件 11122 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\project.xcworkspace\xcuserdata\yijin.xcuserdatad\UserInterfaceState.xcuserstate
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\duodiankeji.xcuserdatad\
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\duodiankeji.xcuserdatad\xcschemes\
文件 346 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\duodiankeji.xcuserdatad\xcschemes\xcschememanagement.plist
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yijin.xcuserdatad\
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yijin.xcuserdatad\xcschemes\
文件 334 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yijin.xcuserdatad\xcschemes\xcschememanagement.plist
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yj.xcuserdatad\
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yj.xcuserdatad\xcschemes\
文件 4388 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yj.xcuserdatad\xcschemes\HttpRequest.xcscheme
文件 663 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcodeproj\xcuserdata\yj.xcuserdatad\xcschemes\xcschememanagement.plist
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\
文件 229 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\contents.xcworkspacedata
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcshareddata\
文件 238 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcuserdata\
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcuserdata\duodiankeji.xcuserdatad\
文件 57402 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcuserdata\duodiankeji.xcuserdatad\UserInterfaceState.xcuserstate
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcuserdata\yijin.xcuserdatad\
文件 66459 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcuserdata\yijin.xcuserdatad\UserInterfaceState.xcuserstate
目录 0 2018-12-25 09:06 SwiftHttpRequest-master\HttpRequest.xcworkspace\xcuserdata\yijin.xcuserdatad\xcdebugger\
............此处省略260个文件信息
- 上一篇:资料.txt
- 下一篇:gRPC+官方文档中文版_1.0
相关资源
- FileIOShell
- ios9.3.2shsh备份
- 2048游戏源码
- XFX 580 镁光BIOS
- 微信小程序网络请求封装以及图片删
- ios简体中文全局转繁体中文
- 苹果iOS免越狱虚拟定位修改方法
- iOS socket连接打印机打印小票
- PHOENIX BIOS 4.0 启动自检代码
- PVE下J4125 核显直通所需的vgabios romfi
- 迪兰恒进战神RX 588原版BIOS
- iOS 日历制作
- ios实现打地鼠的简单版游戏源码加注
- 苹果ios微信摇一摇代码实现
- vega64 黑风公版bios
- FxVideo播放Vungle的单例类
- 昂达G31 BIOS
- 盈通570 4G三星颗粒原版bios
- IOS开发指南(第5版) pdf地址
- 讯景XFX RX480 8G 黑狼版 原厂BIOS 海力士
- LENOVO/联想 启天M7150 升级BIOS 版本90K
- BIOS刷新工具Universal Flash Utility V8.95.
- AWARD BIOS LOGO 修改工具 V1.31.rar
- IOS简单计算器swift4版本含开发文档
- 各种警告框源码
- IOS免越狱插件技术
- 迪兰560原版bios
- 蓝宝石470d单风扇尔必达原厂bios.rom
- DELLBIOS分离过程
- 联想启天M7150 最新BIOS 90KT23CUS含升级操
评论
共有 条评论