├── .DS_Store ├── EasyShowView.podspec ├── EasyShowView ├── .DS_Store ├── EasyAlertConfig.h ├── EasyAlertConfig.m ├── EasyAlertGlobalConfig.h ├── EasyAlertGlobalConfig.m ├── EasyAlertItem.h ├── EasyAlertItem.m ├── EasyAlertPart.h ├── EasyAlertPart.m ├── EasyAlertTypes.h ├── EasyAlertTypes.m ├── EasyAlertView.h ├── EasyAlertView.m ├── EasyEmptyConfig.h ├── EasyEmptyConfig.m ├── EasyEmptyGlobalConfig.h ├── EasyEmptyGlobalConfig.m ├── EasyEmptyPart.h ├── EasyEmptyPart.m ├── EasyEmptyTypes.h ├── EasyEmptyTypes.m ├── EasyEmptyView.h ├── EasyEmptyView.m ├── EasyLoadingConfig.h ├── EasyLoadingConfig.m ├── EasyLoadingGlobalConfig.h ├── EasyLoadingGlobalConfig.m ├── EasyLoadingTypes.h ├── EasyLoadingTypes.m ├── EasyLoadingView.h ├── EasyLoadingView.m ├── EasyShowLabel.h ├── EasyShowLabel.m ├── EasyShowUtils.h ├── EasyShowUtils.m ├── EasyShowView.h ├── EasyTextBgView.h ├── EasyTextBgView.m ├── EasyTextConfig.h ├── EasyTextConfig.m ├── EasyTextGlobalConfig.h ├── EasyTextGlobalConfig.m ├── EasyTextTypes.h ├── EasyTextTypes.m ├── EasyTextView.h ├── EasyTextView.m ├── UIView+EasyShowExt.h └── UIView+EasyShowExt.m ├── EasyShowViewDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── Mr_Chen.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── nf.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── Mr_Chen.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ └── xcschememanagement.plist │ └── nf.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── EasyShowViewDemo ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── icom_hud │ │ ├── Contents.json │ │ ├── icon_hud_1.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_1@2x.png │ │ ├── icon_hud_2.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_2@2x.png │ │ ├── icon_hud_3.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_3@2x.png │ │ ├── icon_hud_4.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_4@2x.png │ │ ├── icon_hud_5.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_5@2x.png │ │ ├── icon_hud_6.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_6@2x.png │ │ ├── icon_hud_7.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_7@2x.png │ │ ├── icon_hud_8.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_8@2x.png │ │ └── icon_hud_9.imageset │ │ │ ├── Contents.json │ │ │ └── icon_hud_9@2x.png │ └── icon_empty │ │ ├── Contents.json │ │ ├── netError.imageset │ │ ├── Contents.json │ │ └── netError@2x.png │ │ ├── noNetFlags.imageset │ │ ├── Contents.json │ │ └── noNetFlags@2x.png │ │ └── nodata_icon.imageset │ │ ├── Contents.json │ │ └── nodata_icon@2x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Bugly.framework │ ├── Bugly │ ├── Headers │ │ ├── Bugly.h │ │ ├── BuglyConfig.h │ │ └── BuglyLog.h │ └── Modules │ │ └── module.modulemap ├── HUD_NF@2x.png ├── Info.plist ├── SecondViewController.h ├── SecondViewController.m ├── ViewController.h ├── ViewController.m └── main.m ├── EasyShowViewDemoUITests ├── EasyShowViewDemoUITests.m └── Info.plist ├── LICENSE ├── README.md ├── README ├── EasyAlert_README.md ├── EasyEmpty_README.md ├── EasyLoding_README.md └── EasyText_README.md ├── note.txt └── show_preview ├── .DS_Store ├── preview_alert.gif ├── preview_all.gif ├── preview_empty.gif ├── preview_loding.gif ├── preview_text.gif └── wechat_icon.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/.DS_Store -------------------------------------------------------------------------------- /EasyShowView.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | 5 | s.name = "EasyShowView" 6 | s.version = "2.1.4" 7 | s.summary = "一款超级简单的展示工具,包括吐丝,loding加载,空白页提示,alertview,actionsheet的定制。可自定义动画,显示样式等各种操作。简单到爆。赶紧来试试吧~~~" 8 | s.homepage = "https://github.com/chenliangloveyou/EasyShowView" 9 | s.license = "MIT" 10 | s.author = { "chenliangloveyou" => "ios_elite@163.com" } 11 | s.source = { :git => "https://github.com/chenliangloveyou/EasyShowView.git", :tag => "#{s.version}"} 12 | s.frameworks = "Foundation", "UIKit" 13 | # s.public_header_files = "Classes/**/*.h" 14 | s.ios.deployment_target= '8.0' 15 | s.source_files = 'EasyShowView/EasyShowView.h' 16 | # s.public_header_files = 'EasyShowView/EasyShowView.h' 17 | 18 | s.subspec 'EasyText' do |ss| 19 | ss.dependency 'EasyShowView/EasyShowUtils' 20 | ss.source_files = 'EasyShowView/EasyText{View,BgView,Config,GlobalConfig,Types}.{h,m}' 21 | # ss.public_header_files = 'EasyShowView/EasyText{View,BgView,Config,GlobalConfig,Types}.h' 22 | end 23 | 24 | s.subspec 'EasyLoading' do |ss| 25 | ss.dependency 'EasyShowView/EasyShowUtils' 26 | ss.source_files = 'EasyShowView/EasyLoading{View,Config,GlobalConfig,Types}.{h,m}' 27 | # ss.public_header_files = 'EasyShowView/EasyLoading{View,Config,GlobalConfig,Types}.h' 28 | end 29 | 30 | s.subspec 'EasyEmpty' do |ss| 31 | ss.dependency 'EasyShowView/EasyShowUtils' 32 | ss.source_files = 'EasyShowView/EasyEmpty{View,Part,Config,GlobalConfig,Types}.{h,m}' 33 | # ss.public_header_files = 'EasyShowView/EasyEmpty{View,Part,Config,GlobalConfig,Types}.h' 34 | end 35 | 36 | s.subspec 'EasyAlert' do |ss| 37 | ss.dependency 'EasyShowView/EasyShowUtils' 38 | ss.source_files = 'EasyShowView/EasyAlert{View,Part,Item,Config,GlobalConfig,Types}.{h,m}' 39 | # ss.public_header_files = 'EasyShowView/EasyAlert{View,Part,Item,Config,GlobalConfig,Types}.h' 40 | end 41 | 42 | s.subspec 'EasyShowUtils' do |ss| 43 | ss.source_files = 'EasyShowView/EasyShow{Utils,Label}.{h,m}', 'EasyShowView/UIView+EasyShowExt.{h,m}' 44 | #ss.public_header_files = 'EasyShowView/EasyShow{Utils,Label}.h', 'EasyShowView/UIView+EasyShowExt.h' 45 | 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /EasyShowView/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowView/.DS_Store -------------------------------------------------------------------------------- /EasyShowView/EasyAlertConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "EasyAlertTypes.h" 12 | #import "EasyShowUtils.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface EasyAlertConfig : NSObject 17 | 18 | @property (nonatomic,strong)UIColor *tintColor ; //alertview的背景颜色 19 | @property (nonatomic,strong)UIColor *titleColor ; //title的字体颜色 20 | @property (nonatomic,strong)UIColor *subtitleColor ;//subtitle的字体颜色 21 | @property (nonatomic,assign)NSTextAlignment subtitleTextAligment ;//subtitle对其方式 22 | @property (nonatomic,assign)BOOL twoItemHorizontal ;//当alertview为两个的时候,是否横着摆放 23 | @property (nonatomic,assign)AlertAnimationType animationType;//alertView:展示和消失的动画类型。(只对自定义的alertview起作用) 24 | //背景的样式。(只对自定义的alertview起作用) 25 | @property (nonatomic,assign)AlertBgEffectType effectType UI_APPEARANCE_SELECTOR; 26 | 27 | @property (nonatomic,assign)BOOL bgViewEvent ; //点击alertview之外的空白区域,是否销毁alertview。默认为:NO 28 | @property (nonatomic,assign)NSUInteger alertViewMaxNum ; //允许出现alertView的最大数量 29 | @property (nonatomic,assign)BOOL isSupportRotating; //是否支持横屏 30 | 31 | + (instancetype)shared ; 32 | 33 | - (EasyAlertConfig *(^)(UIColor *))setTintColor; 34 | - (EasyAlertConfig *(^)(UIColor *))setTitleColor ; 35 | - (EasyAlertConfig *(^)(UIColor *))setSubtitleColor ; 36 | - (EasyAlertConfig *(^)(NSTextAlignment))setSubtitleTextAligment ; 37 | - (EasyAlertConfig *(^)(BOOL))settwoItemHorizontal ; 38 | - (EasyAlertConfig *(^)(AlertAnimationType))setAnimationType ; 39 | - (EasyAlertConfig *(^)(AlertBgEffectType))setEffectType ; 40 | - (EasyAlertConfig *(^)(BOOL))setBgViewEvent ; 41 | - (EasyAlertConfig *(^)(NSUInteger))setAlertViewMaxNum ; 42 | 43 | @end 44 | NS_ASSUME_NONNULL_END 45 | 46 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyAlertConfig.h" 10 | #import "EasyAlertGlobalConfig.h" 11 | @implementation EasyAlertConfig 12 | 13 | 14 | + (instancetype)shared 15 | { 16 | return [[self alloc]init]; 17 | } 18 | - (instancetype)init 19 | { 20 | if (self = [super init]) { 21 | 22 | _alertViewMaxNum = 0 ; 23 | 24 | EasyAlertGlobalConfig *globalC = [EasyAlertGlobalConfig shared]; 25 | _twoItemHorizontal = globalC.twoItemHorizontal ; 26 | _bgViewEvent = globalC.bgViewEvent ; 27 | _animationType = globalC.animationType ; 28 | _effectType = globalC.effectType ; 29 | _isSupportRotating = globalC.isSupportRotating ; 30 | _subtitleTextAligment = NSTextAlignmentCenter ; 31 | } 32 | return self ; 33 | } 34 | 35 | - (EasyAlertConfig * _Nonnull (^)(UIColor *))setTintColor 36 | { 37 | return ^EasyAlertConfig *(UIColor *tintColor){ 38 | self.tintColor = tintColor ; 39 | return self; 40 | }; 41 | } 42 | - (EasyAlertConfig * _Nonnull (^)(UIColor *))setTitleColor 43 | { 44 | return ^EasyAlertConfig *(UIColor *titleColor){ 45 | self.titleColor = titleColor ; 46 | return self; 47 | }; 48 | } 49 | - (EasyAlertConfig * _Nonnull (^)(UIColor *))setSubtitleColor 50 | { 51 | return ^EasyAlertConfig *(UIColor *subtitleColor){ 52 | self.subtitleColor = subtitleColor ; 53 | return self; 54 | }; 55 | } 56 | - (EasyAlertConfig * _Nonnull (^)(NSTextAlignment))setSubtitleTextAligment 57 | { 58 | return ^EasyAlertConfig *(NSTextAlignment alignment){ 59 | self.subtitleTextAligment = alignment ; 60 | return self; 61 | }; 62 | } 63 | - (EasyAlertConfig * _Nonnull (^)(BOOL))settwoItemHorizontal 64 | { 65 | return ^EasyAlertConfig *(BOOL horizontal){ 66 | self.twoItemHorizontal = horizontal ; 67 | return self; 68 | }; 69 | } 70 | - (EasyAlertConfig * _Nonnull (^)(AlertAnimationType))setAnimationType 71 | { 72 | return ^EasyAlertConfig *(AlertAnimationType type){ 73 | self.animationType = type ; 74 | return self; 75 | }; 76 | } 77 | - (EasyAlertConfig * _Nonnull (^)(AlertBgEffectType))setEffectType 78 | { 79 | return ^EasyAlertConfig *(AlertBgEffectType type){ 80 | self.effectType = type ; 81 | return self; 82 | }; 83 | } 84 | - (EasyAlertConfig * _Nonnull (^)(BOOL))setBgViewEvent 85 | { 86 | return ^EasyAlertConfig *(BOOL event){ 87 | self.bgViewEvent = event ; 88 | return self; 89 | }; 90 | } 91 | - (EasyAlertConfig * _Nonnull (^)(NSUInteger))setAlertViewMaxNum 92 | { 93 | return ^EasyAlertConfig *(NSUInteger maxnum){ 94 | self.alertViewMaxNum = maxnum ; 95 | return self; 96 | }; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertGlobalConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertGlobalConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EasyShowUtils.h" 11 | #import "EasyAlertTypes.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface EasyAlertGlobalConfig : NSObject 16 | 17 | //alertview的背景颜色 18 | @property (nonatomic,strong)UIColor *tintColor UI_APPEARANCE_SELECTOR; 19 | 20 | //title的字体颜色 21 | @property (nonatomic,strong)UIColor *titleColor UI_APPEARANCE_SELECTOR; 22 | 23 | //subtitle的字体颜色 24 | @property (nonatomic,strong)UIColor *subtitleColor UI_APPEARANCE_SELECTOR; 25 | 26 | //当alertview为两个的时候,是否横着摆放 27 | @property (nonatomic,assign)BOOL twoItemHorizontal UI_APPEARANCE_SELECTOR; 28 | 29 | //alertView:展示和消失的动画类型。(只对自定义的alertview起作用) 30 | @property (nonatomic,assign)AlertAnimationType animationType UI_APPEARANCE_SELECTOR; 31 | 32 | //背景的样式。(只对自定义的alertview起作用) 33 | @property (nonatomic,assign)AlertBgEffectType effectType UI_APPEARANCE_SELECTOR; 34 | 35 | 36 | //点击alertview之外的空白区域,是否销毁alertview。默认为:NO 37 | @property (nonatomic,assign)BOOL bgViewEvent UI_APPEARANCE_SELECTOR ; 38 | 39 | //允许出现alertView的最大数量 40 | @property (nonatomic,assign)NSUInteger alertViewMaxNum UI_APPEARANCE_SELECTOR; 41 | 42 | //是否支持横屏 43 | @property (nonatomic,assign)BOOL isSupportRotating UI_APPEARANCE_SELECTOR; 44 | 45 | easyShowView_singleton_interface 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | 51 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertGlobalConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertGlobalConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyAlertGlobalConfig.h" 10 | 11 | @implementation EasyAlertGlobalConfig 12 | 13 | easyShowView_singleton_implementation(EasyAlertGlobalConfig) 14 | 15 | - (instancetype)init 16 | { 17 | if (self = [super init]) { 18 | 19 | _tintColor = [UIColor groupTableViewBackgroundColor]; 20 | _titleColor = [UIColor darkTextColor]; 21 | _subtitleColor = [UIColor lightGrayColor]; 22 | _twoItemHorizontal = NO ; 23 | _animationType = AlertAnimationTypeBounce ; 24 | _effectType = AlertBgEffectTypeWoolGlass ; 25 | _bgViewEvent = YES ; 26 | _alertViewMaxNum = 2 ; 27 | } 28 | return self ; 29 | } 30 | @end 31 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertItem.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/14. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EasyAlertTypes.h" 11 | 12 | @interface EasyAlertItem : NSObject 13 | 14 | @property (nonatomic,strong)NSString *title ; //按钮的标题 15 | @property (nonatomic,assign)AlertItemType itemTpye ; //按钮的类型 16 | @property (nonatomic,strong)AlertCallback callback ;//点击按钮的回调 17 | 18 | 19 | + (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type ; 20 | + (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type callback:(AlertCallback)callback ; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertItem.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/14. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyAlertItem.h" 10 | 11 | @implementation EasyAlertItem 12 | 13 | + (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type 14 | { 15 | return [self itemWithTitle:title type:type callback:nil]; 16 | } 17 | + (instancetype)itemWithTitle:(NSString *)title type:(AlertItemType)type callback:(AlertCallback)callback 18 | { 19 | EasyAlertItem *item = [[EasyAlertItem alloc]init]; 20 | item.title = title ; 21 | item.itemTpye = type ; 22 | item.callback = callback ; 23 | return item ; 24 | } 25 | @end 26 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertPart.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertPart.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/14. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EasyAlertTypes.h" 11 | 12 | @interface EasyAlertPart : NSObject 13 | 14 | @property (nonatomic,strong)NSString *title ; //标题 15 | @property (nonatomic,strong)NSString *subtitle ; //副标题 16 | @property (nonatomic,assign)AlertViewType alertType ; //alert类型 分4种 17 | 18 | + (instancetype)shared ; 19 | 20 | - (EasyAlertPart *(^)(NSString *))setTitle ; 21 | - (EasyAlertPart *(^)(NSString *))setSubtitle ; 22 | - (EasyAlertPart *(^)(AlertViewType))setAlertType ; 23 | 24 | + (instancetype)alertPartWithTitle:(NSString *)title ; 25 | + (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle ; 26 | + (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle alertype:(AlertViewType)alerttype ; 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertPart.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertPart.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/14. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyAlertPart.h" 10 | 11 | @implementation EasyAlertPart 12 | 13 | + (instancetype)shared 14 | { 15 | return [self new]; 16 | } 17 | 18 | - (EasyAlertPart *(^)(NSString *))setTitle 19 | { 20 | return ^EasyAlertPart* (NSString *title) { 21 | self.title = title; 22 | return self; 23 | }; 24 | } 25 | - (EasyAlertPart *(^)(NSString *))setSubtitle 26 | { 27 | return ^EasyAlertPart* (NSString *subtitle){ 28 | self.subtitle = subtitle ; 29 | return self ; 30 | }; 31 | } 32 | - (EasyAlertPart *(^)(AlertViewType))setAlertType 33 | { 34 | return ^EasyAlertPart* (AlertViewType type){ 35 | self.alertType = type ; 36 | return self ; 37 | }; 38 | } 39 | 40 | 41 | + (instancetype)alertPartWithTitle:(NSString *)title 42 | { 43 | return [self alertPartWithTitle:title subtitle:nil]; 44 | } 45 | + (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle 46 | { 47 | return [self alertPartWithTitle:title subtitle:subtitle alertype:AlertViewTypeAlert]; 48 | } 49 | + (instancetype)alertPartWithTitle:(NSString *)title subtitle:(NSString *)subtitle alertype:(AlertViewType)alerttype 50 | { 51 | EasyAlertPart *part = [self shared]; 52 | part.title = title ; 53 | part.subtitle = subtitle ; 54 | part.alertType = alerttype ; 55 | return part ; 56 | } 57 | @end 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertTypes.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 添加一个item的样式,只有color和blod可选 13 | */ 14 | typedef NS_ENUM(NSInteger, AlertItemType) { 15 | AlertItemTypeBlack = 1, // 黑色字体 16 | AlertItemTypeBlodBlack , // 黑色加粗字体 17 | AlertItemTypeBlue, // 蓝色字体 18 | AlertItemTypeBlodBlue, // 蓝色加粗字体 19 | AlertItemTypeRed , // 红色字体 20 | AlertItemTypeBlodRed , // 红色加粗字体 21 | AlertItemTypeCustom , //自定义的一种自己,需要配置,如果不配置将会是第一种(黑色字体) 22 | 23 | AlertItemTypeSystemDefault , 24 | AlertItemTypeSystemCancel , 25 | AlertItemTypeSystemDestructive , 26 | }; 27 | 28 | /** 29 | * alertView的动画形式 30 | */ 31 | typedef NS_ENUM(NSInteger , AlertAnimationType) { 32 | AlertAnimationTypeUndefine ,//未定义 33 | AlertAnimationTypeNone ,//无动画 34 | AlertAnimationTypeFade,//alpha改变 35 | AlertAnimationTypeBounce ,//抖动 36 | AlertAnimationTypeZoom, //放大缩小 37 | AlertAnimationTypePush ,//向上push 38 | }; 39 | 40 | 41 | typedef NS_ENUM(NSInteger , AlertViewType) { 42 | AlertViewTypeAlert , //默认类型 43 | AlertViewTypeActionSheet , 44 | AlertViewTypeSystemAlert , 45 | AlertViewTypeSystemActionSheet , 46 | }; 47 | 48 | typedef NS_ENUM(NSInteger , AlertBgEffectType) { 49 | AlertBgEffectTypeUndefine , //默认类型 50 | AlertBgEffectTypeAlphaCover , 51 | AlertBgEffectTypeWoolGlass, 52 | }; 53 | 54 | 55 | @class EasyAlertView ; 56 | 57 | /** 58 | * 点击item回调,注意:如果全局和item都有回调,会优先显示全局的回调 59 | */ 60 | typedef void (^AlertCallback)(EasyAlertView *showview , long index); 61 | 62 | 63 | @interface EasyAlertTypes : NSObject 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertTypes.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertTypes.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyAlertTypes.h" 10 | 11 | @implementation EasyAlertTypes 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyShowView/EasyAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyAlertView.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/12/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EasyAlertTypes.h" 11 | #import "EasyAlertConfig.h" 12 | #import "EasyAlertItem.h" 13 | #import "EasyAlertPart.h" 14 | 15 | @interface EasyAlertView : UIView 16 | 17 | 18 | 19 | /** 20 | * 快速创建AlertView的方法 21 | * 22 | * part alertView的组成部分 标题,副标题,显示类型 23 | * config 配置信息(如果为空,就是使用EasyAlertGlobalConfig中的属性值) 24 | * buttonArray 所以需要显示的按钮 25 | * callback 点击按钮回调 26 | */ 27 | + (EasyAlertView *)alertViewWithPart:(EasyAlertPart *(^)(void))part 28 | config:(EasyAlertConfig *(^)(void))config 29 | buttonArray:(NSArray *(^)(void))buttonArray 30 | callback:(AlertCallback)callback ; 31 | 32 | 33 | 34 | /** 35 | * 第一步:创建一个自定义的Alert/ActionSheet 36 | */ 37 | + (instancetype)alertViewWithTitle:(NSString *)title 38 | subtitle:(NSString *)subtitle 39 | AlertViewType:(AlertViewType)alertType 40 | config:(EasyAlertConfig *(^)(void))config ; 41 | 42 | + (instancetype)alertViewWithPart:(EasyAlertPart *(^)(void))part 43 | config:(EasyAlertConfig *(^)(void))config 44 | callback:(AlertCallback)callback ; 45 | 46 | /** 47 | * 第二步:往创建的alert上面添加事件 48 | */ 49 | - (void)addAlertItemWithTitle:(NSString *)title 50 | type:(AlertItemType)type 51 | callback:(AlertCallback)callback; 52 | - (void)addAlertItem:(EasyAlertItem *(^)(void))item ; 53 | - (void)addAlertItemWithTitleArray:(NSArray *)titleArray 54 | callback:(AlertCallback)callbck ; 55 | 56 | /** 57 | * 第三步:展示alert 58 | */ 59 | - (void)showAlertView ; 60 | 61 | 62 | // 移除alertview 63 | - (void)removeAlertView ; 64 | 65 | 66 | 67 | @end 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface EasyEmptyConfig : NSObject 15 | 16 | 17 | @property (nonatomic,strong)UIColor *bgColor ; //背景颜色 18 | 19 | @property (nonatomic,strong)UIFont *tittleFont ; //标题字体大小 20 | @property (nonatomic,strong)UIColor *titleColor ;//标题字体颜色 21 | 22 | @property (nonatomic,strong)UIFont *subtitleFont ; //副标题字体大小 23 | @property (nonatomic,strong)UIColor *subTitleColor ;//副标题字体颜色 24 | 25 | @property (nonatomic,strong)UIFont *buttonFont ; //按钮字体大小 26 | @property (nonatomic,strong)UIColor *buttonColor ; //按钮字体亚瑟 27 | @property (nonatomic,strong)UIColor *buttonBgColor ;//按钮背景颜色 28 | 29 | @property (nonatomic,assign)UIEdgeInsets easyViewEdgeInsets ;//整个emptyview往内缩的距离(如果为负数,则会超出边界) 30 | @property (nonatomic,assign)UIEdgeInsets buttonEdgeInsets ; //按钮往内缩的边距(按钮四边边缘距离文字的距离) 31 | @property (nonatomic,assign)BOOL scrollVerticalEnable ;//是否可以上下滚动 32 | 33 | + (instancetype)shared ; 34 | - (EasyEmptyConfig *(^)(UIColor *))setBgColor ; 35 | - (EasyEmptyConfig *(^)(UIFont *))setTitleFont ; 36 | - (EasyEmptyConfig *(^)(UIColor *))setTitleColor ; 37 | - (EasyEmptyConfig *(^)(UIFont *))setSubtitleFont ; 38 | - (EasyEmptyConfig *(^)(UIColor *))setSubtitleColor ; 39 | - (EasyEmptyConfig *(^)(UIFont *))setButtonFont ; 40 | - (EasyEmptyConfig *(^)(UIColor *))setButtonColor ; 41 | - (EasyEmptyConfig *(^)(UIColor *))setButtonBgColor ; 42 | - (EasyEmptyConfig *(^)(UIEdgeInsets))setEasyViewEdgeInsets ; 43 | - (EasyEmptyConfig *(^)(UIEdgeInsets))setButtonEdgeInsets ; 44 | - (EasyEmptyConfig *(^)(BOOL))setScrollVerticalEnable ; 45 | 46 | 47 | + (instancetype)configWithBgColor:(UIColor *)bgColor ; 48 | + (instancetype)configWithBgColor:(UIColor *)bgColor titleFount:(UIFont *)titleFount ; 49 | 50 | 51 | @end 52 | 53 | NS_ASSUME_NONNULL_END 54 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyEmptyConfig.h" 10 | #import "EasyEmptyGlobalConfig.h" 11 | 12 | @implementation EasyEmptyConfig 13 | 14 | + (instancetype)shared 15 | { 16 | return [[EasyEmptyConfig alloc]init]; 17 | } 18 | - (instancetype)init{ 19 | if ([super init]) { 20 | EasyEmptyGlobalConfig *globalC = [EasyEmptyGlobalConfig shared] ; 21 | _scrollVerticalEnable = globalC.scrollVerticalEnable ; 22 | _easyViewEdgeInsets = UIEdgeInsetsZero ; 23 | } 24 | return self ; 25 | } 26 | 27 | 28 | - (EasyEmptyConfig *(^)(UIColor *))setBgColor 29 | { 30 | return ^EasyEmptyConfig *(UIColor *bgColor){ 31 | self.bgColor = bgColor ; 32 | return self ; 33 | }; 34 | } 35 | - (EasyEmptyConfig *(^)(UIFont *))setTitleFont 36 | { 37 | return ^EasyEmptyConfig *(UIFont *titleFont){ 38 | self.tittleFont = titleFont ; 39 | return self ; 40 | } ; 41 | } 42 | - (EasyEmptyConfig *(^)(UIColor *))setTitleColor 43 | { 44 | return ^EasyEmptyConfig *(UIColor *titleColor){ 45 | self.titleColor = titleColor ; 46 | return self ; 47 | } ; 48 | } 49 | - (EasyEmptyConfig *(^)(UIFont *))setSubtitleFont 50 | { 51 | return ^EasyEmptyConfig *(UIFont *subtitleFont){ 52 | self.subtitleFont = subtitleFont ; 53 | return self ; 54 | } ; 55 | } 56 | - (EasyEmptyConfig *(^)(UIColor *))setSubtitleColor 57 | { 58 | return ^EasyEmptyConfig *(UIColor *titleColor){ 59 | self.subTitleColor = titleColor ; 60 | return self ; 61 | } ; 62 | } 63 | - (EasyEmptyConfig *(^)(UIFont *))setButtonFont 64 | { 65 | return ^EasyEmptyConfig *(UIFont *buttonFont){ 66 | self.buttonFont = buttonFont ; 67 | return self ; 68 | } ; 69 | } 70 | - (EasyEmptyConfig *(^)(UIColor *))setButtonColor 71 | { 72 | return ^EasyEmptyConfig *(UIColor *buttonColor){ 73 | self.buttonColor = buttonColor ; 74 | return self ; 75 | } ; 76 | } 77 | - (EasyEmptyConfig *(^)(UIColor *))setButtonBgColor 78 | { 79 | return ^EasyEmptyConfig *(UIColor *buttonbgColor){ 80 | self.buttonBgColor = buttonbgColor ; 81 | return self ; 82 | } ; 83 | } 84 | - (EasyEmptyConfig *(^)(UIEdgeInsets))setEasyViewEdgeInsets 85 | { 86 | return ^EasyEmptyConfig *(UIEdgeInsets edge){ 87 | self.easyViewEdgeInsets = edge ; 88 | return self ; 89 | } ; 90 | } 91 | - (EasyEmptyConfig *(^)(UIEdgeInsets))setButtonEdgeInsets 92 | { 93 | return ^EasyEmptyConfig *(UIEdgeInsets edge){ 94 | self.buttonEdgeInsets = edge ; 95 | return self ; 96 | } ; 97 | } 98 | 99 | - (EasyEmptyConfig *(^)(BOOL))setScrollVerticalEnable 100 | { 101 | return ^EasyEmptyConfig *(BOOL enabel){ 102 | self.scrollVerticalEnable = enabel ; 103 | return self ; 104 | } ; 105 | } 106 | 107 | + (instancetype)configWithBgColor:(UIColor *)bgColor 108 | { 109 | return [self configWithBgColor:bgColor titleFount:[EasyEmptyGlobalConfig shared].tittleFont]; 110 | } 111 | + (instancetype)configWithBgColor:(UIColor *)bgColor titleFount:(UIFont *)titleFount 112 | { 113 | EasyEmptyConfig *config = [self shared] ; 114 | config.bgColor = bgColor ; 115 | config.tittleFont = titleFount ; 116 | return config ; 117 | } 118 | @end 119 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyGlobalConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyGlobalConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "EasyShowUtils.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface EasyEmptyGlobalConfig : NSObject 16 | 17 | @property (nonatomic,strong)UIColor *bgColor UI_APPEARANCE_SELECTOR ; //背景颜色 18 | 19 | @property (nonatomic,strong)UIFont *tittleFont UI_APPEARANCE_SELECTOR ; //标题字体大小 20 | @property (nonatomic,strong)UIColor *titleColor UI_APPEARANCE_SELECTOR ;//标题字体颜色 21 | 22 | @property (nonatomic,strong)UIFont *subtitleFont UI_APPEARANCE_SELECTOR ; //副标题字体大小 23 | @property (nonatomic,strong)UIColor *subTitleColor UI_APPEARANCE_SELECTOR ;//副标题字体颜色 24 | 25 | @property (nonatomic,strong)UIFont *buttonFont UI_APPEARANCE_SELECTOR ; //按钮字体大小 26 | @property (nonatomic,strong)UIColor *buttonColor UI_APPEARANCE_SELECTOR ; //按钮字体亚瑟 27 | @property (nonatomic,strong)UIColor *buttonBgColor UI_APPEARANCE_SELECTOR ;//按钮背景颜色 28 | 29 | @property (nonatomic,assign)UIEdgeInsets buttonEdgeInsets UI_APPEARANCE_SELECTOR ; //按钮往内缩的边距(按钮四边边缘距离文字的距离) 30 | 31 | @property (nonatomic,assign)BOOL scrollVerticalEnable ;//是否可以上下滚动 32 | 33 | 34 | easyShowView_singleton_interface 35 | 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | 41 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyGlobalConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyGlobalConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/5. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyEmptyGlobalConfig.h" 10 | 11 | @implementation EasyEmptyGlobalConfig 12 | 13 | easyShowView_singleton_implementation(EasyEmptyGlobalConfig) 14 | 15 | - (instancetype)init 16 | { 17 | if (self = [super init]) { 18 | 19 | _bgColor = [UIColor blackColor]; 20 | _tittleFont = [UIFont systemFontOfSize:17]; 21 | _titleColor = [UIColor blackColor]; 22 | _subtitleFont = [UIFont systemFontOfSize:15]; 23 | _subTitleColor = [UIColor lightGrayColor]; 24 | _buttonFont = [UIFont systemFontOfSize:13]; 25 | _buttonColor = [UIColor blueColor]; 26 | _buttonBgColor = [UIColor whiteColor]; 27 | _buttonEdgeInsets = UIEdgeInsetsMake(15, 20, 15, 20); 28 | _scrollVerticalEnable = YES ; 29 | } 30 | return self ; 31 | } 32 | @end 33 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyPart.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyPart.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/14. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EasyEmptyPart : NSObject 12 | 13 | @property (nonatomic,strong)NSString *title ; //标题 14 | @property (nonatomic,strong)NSString *subtitle ; //副标题 15 | @property (nonatomic,strong)NSString *imageName ; //图片名称 16 | @property (nonatomic,strong)NSArray *buttonArray ;//下面需要的按钮 17 | 18 | + (instancetype)shared ; 19 | - (EasyEmptyPart *(^)(NSString *))setTitle ; 20 | - (EasyEmptyPart *(^)(NSString *))setSubtitle ; 21 | - (EasyEmptyPart *(^)(NSString *))setImageName ; 22 | - (EasyEmptyPart *(^)(NSArray *))setButtonArray ; 23 | 24 | 25 | + (instancetype)itemWithTitle:(NSString *)title ; 26 | + (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle ; 27 | + (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName ; 28 | + (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName buttonArray:(NSArray *)buttonArray ; 29 | 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyPart.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyPart.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/14. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyEmptyPart.h" 10 | 11 | @implementation EasyEmptyPart 12 | 13 | + (instancetype)shared 14 | { 15 | return [[self alloc]init] ; 16 | } 17 | 18 | - (EasyEmptyPart *(^)(NSString *))setTitle 19 | { 20 | return ^EasyEmptyPart* (NSString *title) { 21 | self.title = title; 22 | return self; 23 | }; 24 | } 25 | - (EasyEmptyPart *(^)(NSString *))setSubtitle 26 | { 27 | return ^EasyEmptyPart* (NSString *subtitle){ 28 | self.subtitle = subtitle ; 29 | return self ; 30 | }; 31 | } 32 | - (EasyEmptyPart *(^)(NSString *))setImageName 33 | { 34 | return ^EasyEmptyPart *(NSString *imageName){ 35 | self.imageName = imageName ; 36 | return self ; 37 | }; 38 | } 39 | - (EasyEmptyPart *(^)(NSArray *))setButtonArray 40 | { 41 | return ^EasyEmptyPart *(NSArray *buttonArray){ 42 | self.buttonArray = [buttonArray copy]; 43 | return self ; 44 | }; 45 | } 46 | 47 | 48 | + (instancetype)itemWithTitle:(NSString *)title 49 | { 50 | return [self itemWithTitle:title subtitle:nil]; 51 | } 52 | + (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle 53 | { 54 | return [self itemWithTitle:title subtitle:subtitle imageName:nil]; 55 | } 56 | + (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName 57 | { 58 | return [self itemWithTitle:title subtitle:subtitle imageName:imageName buttonArray:nil]; 59 | } 60 | + (instancetype)itemWithTitle:(NSString *)title subtitle:(NSString *)subtitle imageName:(NSString *)imageName buttonArray:(NSArray *)buttonArray 61 | { 62 | EasyEmptyPart *item = [[EasyEmptyPart alloc]init]; 63 | item.title = title ; 64 | item.subtitle = subtitle ; 65 | item.imageName = imageName ; 66 | item.buttonArray = [buttonArray copy]; 67 | return item ; 68 | } 69 | 70 | 71 | 72 | 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyTypes.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | typedef NS_ENUM(NSInteger , callbackType) { 13 | callbackTypeBgView = 0, 14 | callbackTypeButton_1 = 1, 15 | callbackTypeButton_2 = 2, 16 | }; 17 | 18 | //typedef NS_ENUM(NSUInteger , emptyViewType) { 19 | // emptyViewTypeLoading , 20 | // emptyViewTypeNoData , 21 | // emptyViewTypeNetError , 22 | //// emptyViewTypeCustom , 23 | //}; 24 | 25 | @class EasyEmptyView ; 26 | 27 | typedef void (^emptyViewCallback)(EasyEmptyView *view , UIButton *button , callbackType callbackType); 28 | 29 | 30 | 31 | @interface EasyEmptyTypes : NSObject 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyTypes.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyTypes.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyEmptyTypes.h" 10 | 11 | @implementation EasyEmptyTypes 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyView.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/1/16. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyEmptyPart.h" 12 | #import "EasyEmptyConfig.h" 13 | #import "EasyEmptyTypes.h" 14 | 15 | @interface EasyEmptyView : UIScrollView 16 | 17 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 18 | part:(EasyEmptyPart *(^)(void))part ; 19 | 20 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 21 | part:(EasyEmptyPart *(^)(void))part 22 | config:(EasyEmptyConfig *(^)(void))config ; 23 | 24 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 25 | part:(EasyEmptyPart *(^)(void))part 26 | config:(EasyEmptyConfig *(^)(void))config 27 | callback:(emptyViewCallback)callback ; 28 | 29 | 30 | + (void)hiddenEmptyInView:(UIView *)superView ; 31 | + (void)hiddenEmptyView:(EasyEmptyView *)emptyView ; 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /EasyShowView/EasyEmptyView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyEmptyView.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/1/16. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyEmptyView.h" 10 | 11 | #import "EasyEmptyGlobalConfig.h" 12 | #import "EasyShowUtils.h" 13 | #import "EasyShowLabel.h" 14 | #import "UIView+EasyShowExt.h" 15 | 16 | @interface EasyEmptyView() 17 | 18 | @property (nonatomic,strong)EasyEmptyPart *emptyItem ; 19 | @property (nonatomic,strong)EasyEmptyConfig *emptyConfig ; 20 | @property (nonatomic,strong)emptyViewCallback callback ; 21 | 22 | @property (nonatomic,strong)UIView *bgContentView ; 23 | @property (nonatomic,strong)UILabel *defaultTitleLabel ; 24 | @property (nonatomic,strong)UILabel *defaultSubTitleLabel ; 25 | @property (nonatomic,strong)UIImageView *defaultImageView ; 26 | 27 | @end 28 | 29 | @implementation EasyEmptyView 30 | 31 | - (void)dealloc 32 | { 33 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; 34 | } 35 | - (instancetype)initWithConfig:(EasyEmptyConfig *)config 36 | { 37 | if (self = [super init]) { 38 | 39 | _emptyConfig = config ; 40 | 41 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight ; 42 | self.backgroundColor = config.bgColor ; 43 | self.alwaysBounceVertical = config.scrollVerticalEnable ; 44 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChangeNoti:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil]; 45 | } 46 | return self ; 47 | } 48 | - (void)statusBarChangeNoti:(NSNotification *)notifycation 49 | { 50 | [self layoutemptyViewSubviews]; 51 | } 52 | 53 | - (void)layoutemptyViewSubviews 54 | { 55 | CGFloat contentWidth = [self bgViewWidth];//bgcontentview的高度 56 | __block CGFloat contentHeight = 0 ;//计算bgcontentview的高度 57 | if (!ISEMPTY_S(self.emptyItem.imageName)) { 58 | UIImage *defaultImage = [UIImage imageNamed:self.emptyItem.imageName]; 59 | CGSize imageSize = defaultImage.size ; 60 | if (imageSize.width > contentWidth*2/3.0f) { 61 | imageSize.height = (imageSize.height*(contentWidth*2/3.0f))/imageSize.width ; 62 | imageSize.width= contentWidth*2/3.0f ; 63 | } 64 | self.defaultImageView.frame = CGRectMake((contentWidth-imageSize.width)/2.0f, contentHeight, imageSize.width, imageSize.height) ; 65 | contentHeight += imageSize.height+10 ; 66 | } 67 | 68 | if (!ISEMPTY_S(self.emptyItem.title)) { 69 | CGSize titleSize = [self.defaultTitleLabel sizeThatFits:CGSizeMake(contentWidth, MAXFLOAT)]; 70 | self.defaultTitleLabel.frame = CGRectMake(0, contentHeight, contentWidth, titleSize.height); 71 | 72 | contentHeight += self.defaultTitleLabel.easyS_height ; 73 | } 74 | 75 | if (!ISEMPTY_S(self.emptyItem.subtitle)) { 76 | CGSize titleSize = [self.defaultSubTitleLabel sizeThatFits:CGSizeMake(contentWidth, MAXFLOAT)]; 77 | self.defaultSubTitleLabel.frame = CGRectMake(0, contentHeight, contentWidth, titleSize.height); 78 | 79 | contentHeight += self.defaultSubTitleLabel.easyS_height ; 80 | } 81 | 82 | __weak typeof(NSArray *) weakButtonArray = self.emptyItem.buttonArray ; 83 | [self.bgContentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 84 | if ([obj isKindOfClass:[UIButton class]]) { 85 | CGRect buttonFrame = obj.frame ; 86 | buttonFrame.origin.y = contentHeight+10 ; 87 | 88 | CGFloat buttonX = (contentWidth-obj.easyS_width)/2; 89 | if (weakButtonArray.count == 2) { 90 | buttonX = (contentWidth/2-obj.easyS_width)/2 + ((obj.tag==2)?(contentWidth/2):0) ; 91 | } 92 | buttonFrame.origin.x =buttonX ; 93 | [obj setFrame:buttonFrame]; 94 | 95 | if (weakButtonArray.count==1 || (weakButtonArray.count==2&&obj.tag==2)) { 96 | contentHeight += buttonFrame.size.height+10 ; 97 | } 98 | } 99 | }] ; 100 | 101 | self.bgContentView.frame = CGRectMake((self.easyS_width-contentWidth)/2, (self.easyS_height-contentHeight)/2, contentWidth, contentHeight) ; 102 | 103 | } 104 | - (void)showView 105 | { 106 | if (self.callback) { 107 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(buttonClick:)]; 108 | [self addGestureRecognizer:tapGesture]; 109 | } 110 | [self addSubview:self.bgContentView]; 111 | 112 | if (!ISEMPTY_S(self.emptyItem.imageName)) { 113 | self.defaultImageView.image = [UIImage imageNamed:self.emptyItem.imageName] ; 114 | } 115 | 116 | if (!ISEMPTY_S(self.emptyItem.title)) { 117 | self.defaultTitleLabel.text = self.emptyItem.title ; 118 | } 119 | 120 | if (!ISEMPTY_S(self.emptyItem.subtitle)) { 121 | self.defaultSubTitleLabel.text = self.emptyItem.subtitle ; 122 | } 123 | 124 | for (int i = 0 ; i < self.emptyItem.buttonArray.count; i++) { 125 | UIButton *button = [self defaultButtonWithIndex:i contentWidth:[self bgViewWidth]] ; 126 | [self.bgContentView addSubview:button]; 127 | } 128 | 129 | [self layoutemptyViewSubviews]; 130 | 131 | self.alpha = 0.2 ; 132 | [UIView animateWithDuration:0.3 animations:^{ 133 | self.alpha = 1 ; 134 | }] ; 135 | 136 | } 137 | 138 | - (UIButton *)defaultButtonWithIndex:(long)index contentWidth:(CGFloat)contentWidth 139 | { 140 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 141 | [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; 142 | [button setTitleColor:self.emptyConfig.buttonColor forState:UIControlStateNormal]; 143 | [button setTitleColor:[self.emptyConfig.buttonColor colorWithAlphaComponent:0.5f] forState:UIControlStateHighlighted]; 144 | UIImage *bgNormalImg = [EasyShowUtils imageWithColor:self.emptyConfig.buttonBgColor] ; 145 | [button setBackgroundImage:bgNormalImg forState:UIControlStateNormal]; 146 | UIImage *bgHightImg = [EasyShowUtils imageWithColor:[self.emptyConfig.buttonBgColor colorWithAlphaComponent:0.5f]] ; 147 | [button setBackgroundImage:bgHightImg forState:UIControlStateHighlighted]; 148 | button.titleLabel.numberOfLines = 0 ; 149 | [button setTitleEdgeInsets:self.emptyConfig.buttonEdgeInsets]; 150 | button.titleLabel.font = self.emptyConfig.buttonFont ; 151 | [button setTag:index+1]; 152 | 153 | NSString *titleString = self.emptyItem.buttonArray[index]; 154 | CGFloat buttonMaxWidth = contentWidth/self.emptyItem.buttonArray.count - self.emptyConfig.buttonEdgeInsets.left - self.emptyConfig.buttonEdgeInsets.right ; 155 | NSMutableAttributedString *astr = [[NSMutableAttributedString alloc] initWithString:titleString attributes:nil]; 156 | [astr setAttributes:@{NSFontAttributeName:button.titleLabel.font} range:NSMakeRange(0, titleString.length)]; 157 | CGSize buttonSize = [astr boundingRectWithSize:CGSizeMake(buttonMaxWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size; 158 | buttonSize = CGSizeMake(buttonSize.width+self.emptyConfig.buttonEdgeInsets.left + self.emptyConfig.buttonEdgeInsets.right, buttonSize.height+self.emptyConfig.buttonEdgeInsets.top+self.emptyConfig.buttonEdgeInsets.bottom) ; 159 | [button setFrame:CGRectMake(0, 0, buttonSize.width, buttonSize.height)]; 160 | [button setRoundedCorners:4]; 161 | 162 | [button setTitle:titleString forState:UIControlStateNormal]; 163 | 164 | return button ; 165 | } 166 | - (void)buttonClick:(UIButton *)button 167 | { 168 | [EasyEmptyView hiddenEmptyView:self]; 169 | 170 | if (self.callback) { 171 | if ([button isKindOfClass:[UIButton class]]) { 172 | self.callback(self, button, button.tag) ; 173 | return ; 174 | } 175 | self.callback(self, nil, callbackTypeBgView); 176 | } 177 | } 178 | 179 | 180 | #pragma mark - getter 181 | 182 | 183 | - (CGFloat)bgViewWidth 184 | { 185 | CGFloat contentWidth = self.easyS_width*0.7 ;//计算bgcontentview的宽度 186 | if (contentWidth < 200) { //如果superview的宽度小于200 就应该是全部宽度 187 | contentWidth = self.easyS_width ; 188 | } 189 | return contentWidth ; 190 | } 191 | 192 | - (UIView *)bgContentView 193 | { 194 | if (nil == _bgContentView) { 195 | _bgContentView = [[UIView alloc]init]; 196 | _bgContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight ; 197 | _bgContentView.backgroundColor = kColorRandom_S ; 198 | } 199 | return _bgContentView ; 200 | } 201 | 202 | - (UIImageView *)defaultImageView 203 | { 204 | if (nil == _defaultImageView) { 205 | _defaultImageView = [[UIImageView alloc]init]; 206 | _defaultImageView.backgroundColor = kColorRandom_S ; 207 | [self.bgContentView addSubview:_defaultImageView]; 208 | } 209 | return _defaultImageView ; 210 | } 211 | - (UILabel *)defaultSubTitleLabel 212 | { 213 | if (nil == _defaultSubTitleLabel) { 214 | _defaultSubTitleLabel = [[EasyShowLabel alloc] initWithContentInset:UIEdgeInsetsMake(10, 20, 10, 20)]; 215 | _defaultSubTitleLabel.textColor = self.emptyConfig.subTitleColor ; 216 | _defaultSubTitleLabel.font = self.emptyConfig.subtitleFont ; 217 | _defaultSubTitleLabel.numberOfLines = 0 ; 218 | _defaultSubTitleLabel.textAlignment = NSTextAlignmentCenter ; 219 | _defaultSubTitleLabel.backgroundColor = kColorRandom_S ; 220 | [self.bgContentView addSubview:_defaultSubTitleLabel]; 221 | } 222 | return _defaultSubTitleLabel ; 223 | } 224 | - (UILabel *)defaultTitleLabel 225 | { 226 | if (nil == _defaultTitleLabel) { 227 | _defaultTitleLabel = [[EasyShowLabel alloc] initWithContentInset:UIEdgeInsetsMake(10, 30, 10, 30)];; 228 | _defaultTitleLabel.textColor = self.emptyConfig.titleColor ; 229 | _defaultTitleLabel.font = self.emptyConfig.tittleFont ; 230 | _defaultTitleLabel.numberOfLines = 0 ; 231 | _defaultTitleLabel.backgroundColor = kColorRandom_S ; 232 | _defaultTitleLabel.textAlignment = NSTextAlignmentCenter ; 233 | [self.bgContentView addSubview:_defaultTitleLabel]; 234 | } 235 | return _defaultTitleLabel ; 236 | } 237 | 238 | #pragma mark - 类方法 239 | 240 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 241 | part:(EasyEmptyPart *(^)(void))part 242 | { 243 | return [self showEmptyInView:superview part:part config:nil]; 244 | } 245 | 246 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 247 | part:(EasyEmptyPart *(^)(void))part 248 | config:(EasyEmptyConfig *(^)(void))config 249 | { 250 | return [self showEmptyInView:superview part:part config:config callback:nil]; 251 | } 252 | 253 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 254 | part:(EasyEmptyPart *(^)(void))part 255 | config:(EasyEmptyConfig *(^)(void))config 256 | callback:(emptyViewCallback)callback 257 | { 258 | 259 | EasyEmptyConfig *emptyConfig = [self changeConfigWithConfig:config] ; 260 | EasyEmptyPart *emptyItem = part() ; 261 | 262 | NSAssert(emptyItem.buttonArray.count<3, @"you can't set more than two button") ; 263 | 264 | EasyEmptyView *emptyView = [[EasyEmptyView alloc]initWithConfig:emptyConfig]; 265 | emptyView.emptyItem =emptyItem ; 266 | emptyView.callback = callback ; 267 | 268 | UIEdgeInsets edge = emptyConfig.easyViewEdgeInsets ; 269 | CGFloat viewW = superview.easyS_width-edge.left-edge.right ; 270 | CGFloat viewH = superview.easyS_height-edge.top-edge.bottom ; 271 | [emptyView setFrame:CGRectMake(edge.left, edge.top, viewW,viewH )] ; 272 | 273 | [superview addSubview:emptyView] ; 274 | 275 | [emptyView showView]; 276 | 277 | return emptyView ; 278 | } 279 | 280 | 281 | + (void)hiddenEmptyView:(EasyEmptyView *)emptyView 282 | { 283 | [UIView animateWithDuration:.3 animations:^{ 284 | emptyView.alpha = 0.2 ; 285 | } completion:^(BOOL finished) { 286 | [emptyView removeFromSuperview]; 287 | }] ; 288 | } 289 | + (void)hiddenEmptyInView:(UIView *)superView 290 | { 291 | 292 | NSAssert([NSThread isMainThread], @"needs to be accessed on the main thread."); 293 | if (![NSThread isMainThread]) { 294 | dispatch_async(dispatch_get_main_queue(), ^(void) { 295 | }); 296 | } 297 | 298 | NSEnumerator *subviewsEnum = [superView.subviews reverseObjectEnumerator]; 299 | for (UIView *subview in subviewsEnum) { 300 | if ([subview isKindOfClass:self]) { 301 | EasyEmptyView *emptyView = (EasyEmptyView *)subview ; 302 | [self hiddenEmptyView:emptyView]; 303 | } 304 | } 305 | } 306 | 307 | + (EasyEmptyConfig *)changeConfigWithConfig:(EasyEmptyConfig *(^)(void))config 308 | { 309 | EasyEmptyConfig *tempConfig = config ? config() : nil ; 310 | if (!tempConfig) { 311 | tempConfig = [EasyEmptyConfig shared] ; 312 | } 313 | 314 | EasyEmptyGlobalConfig *globalConfig = [EasyEmptyGlobalConfig shared]; 315 | 316 | if (!tempConfig.bgColor) { 317 | tempConfig.bgColor = globalConfig.bgColor ; 318 | } 319 | if (!tempConfig.tittleFont) { 320 | tempConfig.tittleFont =globalConfig.tittleFont; 321 | } 322 | if (!tempConfig.titleColor) { 323 | tempConfig.titleColor = globalConfig.titleColor ; 324 | } 325 | if (!tempConfig.subtitleFont) { 326 | tempConfig.subtitleFont = globalConfig.subtitleFont; 327 | } 328 | if (!tempConfig.subTitleColor) { 329 | tempConfig.subTitleColor = globalConfig.subTitleColor ; 330 | } 331 | if (!tempConfig.buttonFont) { 332 | tempConfig.buttonFont = globalConfig.buttonFont ; 333 | } 334 | if (!tempConfig.buttonColor) { 335 | tempConfig.buttonColor = globalConfig.buttonColor; 336 | } 337 | if (!tempConfig.buttonBgColor) { 338 | tempConfig.buttonBgColor = globalConfig.buttonBgColor; 339 | } 340 | 341 | if (tempConfig.buttonEdgeInsets.top==0 && tempConfig.buttonEdgeInsets.left==0 342 | && tempConfig.buttonEdgeInsets.bottom==0 && tempConfig.buttonEdgeInsets.right==0 ) { 343 | tempConfig.buttonEdgeInsets = globalConfig.buttonEdgeInsets ; 344 | } 345 | return tempConfig ; 346 | } 347 | 348 | //+ (void)showEmptyViewLoadingWithImageName:(NSString *)imageName 349 | // callback:(emptyViewCallback)callback 350 | //{ 351 | //} 352 | // 353 | //+ (void)showEmptyViewLoadingWithTitle:(NSString *)title 354 | // callback:(emptyViewCallback)callback 355 | //{ 356 | //} 357 | /* 358 | // Only override drawRect: if you perform custom drawing. 359 | // An empty implementation adversely affects performance during animation. 360 | - (void)drawRect:(CGRect)rect { 361 | // Drawing code 362 | } 363 | */ 364 | 365 | @end 366 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/4. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "EasyLoadingTypes.h" 12 | #import "EasyShowUtils.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface EasyLoadingConfig : NSObject 17 | 18 | 19 | /** 显示Loading所需要的父视图 **/ 20 | @property (nonatomic,strong)UIView *superView ; 21 | 22 | /** 加载框所显示的类型 **/ 23 | @property LoadingShowType LoadingType ; 24 | 25 | /** 显示/隐藏 加载框的动画 **/ 26 | @property LoadingAnimationType animationType ; 27 | 28 | /** 在显示加载框的时候,superview能否接收事件。默认为NO **/ 29 | @property BOOL superReceiveEvent ; 30 | 31 | /** 32 | * 是否将加载框显示到window上面。默认为NO(此属性只有在不传superview的时候有效) 33 | * 当为NO: 加载框会遮盖住最上面一个controller的大小。如果superReceiveEvent为NO,那么superview不接受事件,返回按钮会有效。 34 | * 当为YES:加载框会在盖住整个window的大小。如果superReceiveEvent为NO,那么在不隐藏加载框的时候返回事件都会被遮住。 35 | * 36 | */ 37 | @property BOOL showOnWindow ; 38 | 39 | 40 | /** 圆角大小 **/ 41 | @property (nonatomic,assign)CGFloat cycleCornerWidth ; 42 | 43 | /** 加载框主体颜色 **/ 44 | @property (nonatomic,strong)UIColor * tintColor ; 45 | 46 | /** 文字字体大小 **/ 47 | @property (nonatomic,strong)UIFont * textFont ; 48 | 49 | /** 背景颜色 **/ 50 | @property (nonatomic,strong)UIColor * bgColor ; 51 | 52 | /** 图片动画类型 所需要的图片数组 **/ 53 | @property (nonatomic,strong)NSArray * playImagesArray ; 54 | 55 | 56 | 57 | #pragma mark - 创建对象的简便方法 58 | 59 | + (instancetype)shared ; 60 | 61 | 62 | #pragma mark - 链式编程设置属性(和上面直接设置属性一样) 63 | 64 | - (EasyLoadingConfig *(^)(UIView *))setSuperView ; 65 | - (EasyLoadingConfig *(^)(BOOL))setSuperReceiveEvent ; 66 | - (EasyLoadingConfig *(^)(LoadingShowType))setLoadingType ; 67 | - (EasyLoadingConfig *(^)(LoadingAnimationType animationType))setAnimationType ; 68 | - (EasyLoadingConfig *(^)(BOOL))setShowOnWindow ; 69 | - (EasyLoadingConfig *(^)(CGFloat))setCycleCornerWidth ; 70 | - (EasyLoadingConfig *(^)(UIColor *))setTintColor ; 71 | - (EasyLoadingConfig *(^)(UIFont *))setTextFont ; 72 | - (EasyLoadingConfig *(^)(UIColor *))setBgColor ; 73 | - (EasyLoadingConfig *(^)(NSArray *))setPlayImagesArray ; 74 | 75 | 76 | #pragma mark - 类方法设置属性(和上面直接设置属性一样) 77 | 78 | + (instancetype)configInView:(UIView *)superView ; 79 | 80 | + (instancetype)configInView:(UIView *)superView 81 | showType:(LoadingShowType)showType; 82 | 83 | + (instancetype)configInView:(UIView *)superView 84 | showType:(LoadingShowType)showType 85 | animationType:(LoadingAnimationType)animationType; 86 | 87 | + (instancetype)configInView:(UIView *)superView 88 | showType:(LoadingShowType)showType 89 | animationType:(LoadingAnimationType)animationType 90 | superReceive:(BOOL)receive ; 91 | 92 | 93 | 94 | @end 95 | 96 | NS_ASSUME_NONNULL_END 97 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/4. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyLoadingConfig.h" 10 | #import "EasyShowUtils.h" 11 | #import "EasyLoadingGlobalConfig.h" 12 | 13 | @implementation EasyLoadingConfig 14 | 15 | + (instancetype)shared 16 | { 17 | return [[self alloc]init]; 18 | } 19 | - (instancetype)init 20 | { 21 | if (self = [super init]) { 22 | EasyLoadingGlobalConfig *golbalC = [EasyLoadingGlobalConfig shared]; 23 | _LoadingType = golbalC.LoadingType ; 24 | _animationType = golbalC.animationType ; 25 | _superReceiveEvent = golbalC.superReceiveEvent ; 26 | _showOnWindow = golbalC.showOnWindow ; 27 | } 28 | return self ; 29 | } 30 | 31 | - (EasyLoadingConfig *(^)(UIView *))setSuperView { 32 | return ^EasyLoadingConfig *(UIView *spuerView){ 33 | self.superView = spuerView ; 34 | return self ; 35 | }; 36 | } 37 | - (EasyLoadingConfig *(^)(BOOL))setSuperReceiveEvent{ 38 | return ^EasyLoadingConfig *(BOOL receive){ 39 | self.superReceiveEvent = receive ; 40 | return self ; 41 | } ; 42 | } 43 | - (EasyLoadingConfig *(^)(LoadingShowType))setLoadingType { 44 | return ^EasyLoadingConfig *(LoadingShowType showtype){ 45 | self.LoadingType = showtype ; 46 | return self ; 47 | }; 48 | } 49 | - (EasyLoadingConfig *(^)(LoadingAnimationType))setAnimationType { 50 | return ^EasyLoadingConfig *(LoadingAnimationType animationtype){ 51 | self.animationType = animationtype ; 52 | return self ; 53 | }; 54 | } 55 | - (EasyLoadingConfig *(^)(BOOL))setShowOnWindow { 56 | return ^EasyLoadingConfig *(BOOL showOnWindow){ 57 | self.showOnWindow = showOnWindow ; 58 | return self ; 59 | }; 60 | } 61 | - (EasyLoadingConfig *(^)(CGFloat))setCycleCornerWidth{ 62 | return ^EasyLoadingConfig *(CGFloat cornerWidth){ 63 | self.cycleCornerWidth = cornerWidth ; 64 | return self ; 65 | }; 66 | } 67 | 68 | - (EasyLoadingConfig *(^)(UIColor *))setTintColor{ 69 | return ^EasyLoadingConfig *(UIColor *titleColor){ 70 | self.tintColor = titleColor ; 71 | return self ; 72 | }; 73 | } 74 | - (EasyLoadingConfig *(^)(UIFont *))setTextFont { 75 | return ^EasyLoadingConfig *(UIFont *textFont){ 76 | self.textFont = textFont ; 77 | return self ; 78 | }; 79 | } 80 | - (EasyLoadingConfig *(^)(UIColor *))setBgColor { 81 | return ^EasyLoadingConfig *(UIColor *bgcolor){ 82 | self.bgColor = bgcolor ; 83 | return self ; 84 | }; 85 | } 86 | - (EasyLoadingConfig *(^)(NSArray *))setPlayImagesArray 87 | { 88 | return ^EasyLoadingConfig *(NSArray *playImagesArray){ 89 | self.playImagesArray = playImagesArray ; 90 | return self ; 91 | }; 92 | } 93 | 94 | 95 | 96 | + (instancetype)configInView:(UIView *)superView 97 | { 98 | return [EasyLoadingConfig configInView:superView 99 | showType:LoadingShowTypeUnDefine]; 100 | } 101 | 102 | + (instancetype)configInView:(UIView *)superView 103 | showType:(LoadingShowType)showType 104 | { 105 | return [self configInView:superView 106 | showType:showType 107 | animationType:LoadingAnimationTypeUndefine]; 108 | } 109 | 110 | + (instancetype)configInView:(UIView *)superView 111 | showType:(LoadingShowType)showType 112 | animationType:(LoadingAnimationType)animationType 113 | { 114 | return [self configInView:superView 115 | showType:showType 116 | animationType:animationType 117 | superReceive:[EasyLoadingGlobalConfig shared].superReceiveEvent]; 118 | } 119 | 120 | + (instancetype)configInView:(UIView *)superView 121 | showType:(LoadingShowType)showType 122 | animationType:(LoadingAnimationType)animationType 123 | superReceive:(BOOL)receive 124 | { 125 | EasyLoadingConfig *config = [[EasyLoadingConfig alloc]init]; 126 | config.superView = superView ; 127 | config.superReceiveEvent = receive ; 128 | config.LoadingType = showType ; 129 | config.animationType = animationType ; 130 | return config ; 131 | } 132 | @end 133 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingGlobalConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingGlobalConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/4. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "EasyLoadingTypes.h" 12 | #import "EasyShowUtils.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | 17 | @interface EasyLoadingGlobalConfig : NSObject 18 | 19 | easyShowView_singleton_interface 20 | 21 | 22 | /** 加载框所显示的类型 **/ 23 | @property LoadingShowType LoadingType UI_APPEARANCE_SELECTOR ; 24 | 25 | /** 显示/隐藏 加载框的动画 **/ 26 | @property LoadingAnimationType animationType UI_APPEARANCE_SELECTOR ; 27 | 28 | /** 在显示加载框的时候,superview能否接收事件。默认为NO **/ 29 | @property BOOL superReceiveEvent UI_APPEARANCE_SELECTOR ; 30 | 31 | /** 32 | * 是否将加载框显示到window上面。默认为NO(此属性只有在不传superview的时候有效) 33 | * 当为NO: 加载框会遮盖住最上面一个controller的大小。如果superReceiveEvent为NO,那么superview不接受事件,返回按钮会有效。 34 | * 当为YES:加载框会在盖住整个window的大小。如果superReceiveEvent为NO,那么在不隐藏加载框的时候返回事件都会被遮住。 35 | * 36 | */ 37 | @property BOOL showOnWindow UI_APPEARANCE_SELECTOR ; 38 | 39 | 40 | /** 圆角大小 **/ 41 | @property (nonatomic,assign)CGFloat cycleCornerWidth UI_APPEARANCE_SELECTOR ; 42 | 43 | /** 加载框主体颜色 **/ 44 | @property (nonatomic,strong)UIColor * tintColor UI_APPEARANCE_SELECTOR ; 45 | 46 | /** 文字字体大小 **/ 47 | @property (nonatomic,strong)UIFont * textFont UI_APPEARANCE_SELECTOR ; 48 | 49 | /** 背景颜色 **/ 50 | @property (nonatomic,strong)UIColor * bgColor UI_APPEARANCE_SELECTOR ; 51 | 52 | /** 图片动画类型 所需要的图片数组 **/ 53 | @property (nonatomic,strong)NSArray * playImagesArray UI_APPEARANCE_SELECTOR ; 54 | 55 | 56 | 57 | 58 | @end 59 | 60 | NS_ASSUME_NONNULL_END 61 | 62 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingGlobalConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingGlobalConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/4. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyLoadingGlobalConfig.h" 10 | 11 | @implementation EasyLoadingGlobalConfig 12 | 13 | easyShowView_singleton_implementation(EasyLoadingGlobalConfig) 14 | 15 | - (instancetype)init 16 | { 17 | if (self = [super init]) { 18 | 19 | _LoadingType = LoadingShowTypeTurnAround ; 20 | _animationType = LoadingAnimationTypeBounce ; 21 | _textFont = [UIFont systemFontOfSize:15]; 22 | _tintColor = [UIColor blackColor]; 23 | _bgColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.05]; 24 | _superReceiveEvent = YES ; 25 | _showOnWindow = NO ; 26 | _cycleCornerWidth = 5 ; 27 | 28 | } 29 | return self ; 30 | } 31 | @end 32 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingTypes.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /** 13 | * 加载框的样式 14 | */ 15 | typedef NS_ENUM(NSInteger , LoadingShowType) { 16 | 17 | LoadingShowTypeUnDefine = 0 , /** 未定义 */ 18 | LoadingShowTypeTurnAround = 1 , //默认转圈样式 19 | LoadingShowTypeTurnAroundLeft = 2 , //默认在左边转圈样式 20 | 21 | LoadingShowTypeIndicator = 3 , //菊花样式 22 | LoadingShowTypeIndicatorLeft = 4 , //菊花在左边的样式 23 | 24 | LoadingShowTypePlayImages = 5 , //以一个图片数组轮流播放(需添加一组图片) 25 | LoadingShowTypePlayImagesLeft = 6 , //以一个图片数组轮流播放需添加一组图片) 26 | 27 | LoadingShowTypeImageUpturn = 7 ,//自定义图片翻转样式 28 | LoadingShowTypeImageUpturnLeft= 8 ,//自动以图片左边翻转样式 29 | 30 | LoadingShowTypeImageAround = 9 ,//自定义图片边缘转圈样式 31 | LoadingShowTypeImageAroundLeft= 10 ,//自动以图片左边边缘转圈样式 32 | }; 33 | 34 | /** 35 | * 动画类型 36 | */ 37 | typedef NS_ENUM(NSInteger , LoadingAnimationType) { 38 | LoadingAnimationTypeUndefine = 0 , /** 未定义 */ 39 | LoadingAnimationTypeNone ,//无动画 40 | LoadingAnimationTypeFade,//alpha改变 41 | LoadingAnimationTypeBounce ,//抖动 42 | } ; 43 | 44 | 45 | UIKIT_EXTERN const CGFloat EasyShowLoadingMaxWidth ; //显示文字的最大宽度(高度已限制死) 46 | UIKIT_EXTERN const CGFloat EasyShowLoadingImageEdge ; //加载框图片的边距 47 | UIKIT_EXTERN const CGFloat EasyShowLoadingImageWH ; //加载框图片的大小 48 | UIKIT_EXTERN const CGFloat EasyShowLoadingImageMaxWH ; //加载框图片的最大宽度 49 | 50 | @interface EasyLoadingTypes : NSObject 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingTypes.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingTypes.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyLoadingTypes.h" 10 | 11 | 12 | const CGFloat EasyShowLoadingMaxWidth = 200 ; //显示文字的最大宽度(高度已限制死) 13 | const CGFloat EasyShowLoadingImageEdge = 10 ; //加载框图片的边距 14 | const CGFloat EasyShowLoadingImageWH = 30 ; //加载框图片的大小 15 | const CGFloat EasyShowLoadingImageMaxWH = 60 ; //加载框图片的最大宽度 16 | 17 | @implementation EasyLoadingTypes 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /EasyShowView/EasyLoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyLoadingView.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/12/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyLoadingConfig.h" 12 | 13 | @interface EasyLoadingView : UIView 14 | 15 | /** 16 | * 显示一个加载框(config:显示属性设置) 17 | */ 18 | + (EasyLoadingView *)showLoading ; 19 | + (EasyLoadingView *)showLoadingText:(NSString *)text ; 20 | + (EasyLoadingView *)showLoadingText:(NSString *)text 21 | config:(EasyLoadingConfig *(^)(void))config ; 22 | 23 | /** 24 | * 显示一个带图片的加载框 (config:显示属性设置) 25 | */ 26 | + (EasyLoadingView *)showLoadingText:(NSString *)text 27 | imageName:(NSString *)imageName ; 28 | + (EasyLoadingView *)showLoadingText:(NSString *)text 29 | imageName:(NSString *)imageName 30 | config:(EasyLoadingConfig *(^)(void))config ; 31 | 32 | /** 33 | * 移除一个加载框 34 | * superview:加载框所在的父视图。(如果show没指定父视图。那么隐藏也不用) 35 | */ 36 | + (void)hidenLoading ; 37 | + (void)hidenLoingInView:(UIView *)superView ; 38 | + (void)hidenLoading:(EasyLoadingView *)LoadingView ; 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /EasyShowView/EasyShowLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyShowLabel.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/12/20. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EasyShowLabel : UILabel 12 | 13 | - (instancetype)initWithContentInset:(UIEdgeInsets)contentInset ; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /EasyShowView/EasyShowLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyShowLabel.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/12/20. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyShowLabel.h" 10 | 11 | @interface EasyShowLabel() 12 | 13 | @property (nonatomic) UIEdgeInsets contentInset; 14 | 15 | @end 16 | 17 | @implementation EasyShowLabel 18 | 19 | 20 | - (instancetype)initWithContentInset:(UIEdgeInsets)contentInset 21 | { 22 | if (self = [super init]) { 23 | _contentInset = contentInset ; 24 | } 25 | return self ; 26 | } 27 | - (void)setContentInset:(UIEdgeInsets)contentInset { 28 | _contentInset = contentInset; 29 | NSString *tempString = self.text; 30 | self.text = @""; 31 | self.text = tempString; 32 | } 33 | - (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines 34 | { 35 | UIEdgeInsets insets = self.contentInset; 36 | CGRect rect = [super textRectForBounds:UIEdgeInsetsInsetRect(bounds, insets) 37 | limitedToNumberOfLines:numberOfLines]; 38 | 39 | rect.origin.x -= insets.left; 40 | rect.origin.y -= insets.top; 41 | rect.size.width += (insets.left + insets.right); 42 | rect.size.height += (insets.top + insets.bottom); 43 | 44 | return rect; 45 | } 46 | -(void)drawTextInRect:(CGRect)rect 47 | { 48 | [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.contentInset)]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /EasyShowView/EasyShowUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyShowUtils.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | // 是否为空 13 | #define ISEMPTY_S(_v) (_v == nil || _v.length == 0) 14 | 15 | 16 | //屏幕宽度 17 | #define SCREEN_WIDTH_S [[UIScreen mainScreen] bounds].size.width 18 | //屏幕高度 19 | #define SCREEN_HEIGHT_S [[UIScreen mainScreen] bounds].size.height 20 | //屏幕的高度 21 | #define SCREEN_MAX_LENGTH_S (MAX(SCREEN_WIDTH_S, SCREEN_HEIGHT_S)) 22 | 23 | //屏幕是否是横屏状态 24 | #define ISHORIZONTALSCREEM_S UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) 25 | //retain屏 26 | #define ISRETAIN_S ([[UIScreen mainScreen] scale] >= 2.0) 27 | //屏幕尺寸判断 28 | #define ISIPHONE_S (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 29 | //#define ISIPHONE_4 (ISIPHONE && SCREEN_MAX_LENGTH == 480.0f) // 4/4s 3.5寸 320*480 30 | //#define ISIPHONE_5 (ISIPHONE && SCREEN_MAX_LENGTH == 568.0f) // 5/5s/se 4寸 320*568 31 | //#define ISIPHONE_6 (ISIPHONE && SCREEN_MAX_LENGTH == 667.0f) // 6/6s/7/8 4.7寸 375*667 32 | //#define ISIPHONE_6P (ISIPHONE && SCREEN_MAX_LENGTH == 736.0f) // 6p/6ps/7p/8p 5.5寸 414*736 33 | #define ISIPHONE_X_S (ISIPHONE_S && SCREEN_MAX_LENGTH_S == 812.0f) // iPhonex 5.8寸 375*812 34 | 35 | //iOS版本判断 36 | //#define SYSTEM_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) 37 | //#define IS_IOS7_OR_LATER (SYSTEM_VERSION >= 7.0) 38 | //#define IS_IOS8_OR_LATER (SYSTEM_VERSION >= 8.0) 39 | //#define IS_IOS9_OR_LATER (SYSTEM_VERSION >= 9.0) 40 | //#define IS_IOS10_OR_LATER (SYSTEM_VERSION >= 10.0) 41 | //#define IS_IOS11_OR_LATER (SYSTEM_VERSION >= 11.0) 42 | 43 | 44 | //statusbar默认高度 orginal 45 | #define STATUSBAR_HEIGHT_S (ISIPHONE_X_S ? (50) : 20 ) 46 | 47 | //导航栏原始高度 48 | #define kNavNormalHeight_S 44.0f 49 | 50 | //大标题增加出来的高度 51 | #define kNavBigTitleHeight_S 55.0f 52 | 53 | #define kEasyShowSafeBottomMargin_S (ISIPHONE_X_S ? 34.0f : 0.0f ) 54 | 55 | /*随机颜色*/ //[UIColor clearColor];// 56 | #define kColorRandom_S [UIColor clearColor];//kColor_S(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) 57 | #define kColor_S(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] 58 | 59 | //状态栏高度 60 | #define NAVIGATION_HEIGHT_S (STATUSBAR_HEIGHT_S + kNavNormalHeight_S) 61 | //#define STATUSBAR_HEIGHT (ISHORIZONTALSCREEM ? (ISIPHONE_X ? 0 : STATUSBAR_HEIGHT) : STATUSBAR_HEIGHT ) 62 | 63 | 64 | #define kEasyShowKeyWindow ([UIApplication sharedApplication].keyWindow) 65 | 66 | //推迟执行 67 | CG_INLINE void dispatch_queue_after_S(CGFloat time ,dispatch_block_t block) { 68 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(time * NSEC_PER_SEC)), dispatch_get_main_queue(), block); 69 | } 70 | 71 | // .h 72 | #define easyShowView_singleton_interface + (instancetype)shared ; 73 | // .m 74 | #define easyShowView_singleton_implementation(class) \ 75 | static class *_showInstance; \ 76 | + (id)allocWithZone:(struct _NSZone *)zone { \ 77 | static dispatch_once_t onceToken; \ 78 | dispatch_once(&onceToken, ^{ \ 79 | _showInstance = [super allocWithZone:zone]; \ 80 | }); \ 81 | return _showInstance; \ 82 | } \ 83 | + (instancetype)shared { \ 84 | if (nil == _showInstance) { \ 85 | static dispatch_once_t onceToken; \ 86 | dispatch_once(&onceToken, ^{ \ 87 | _showInstance = [[class alloc] init]; \ 88 | }); \ 89 | } \ 90 | return _showInstance; \ 91 | } \ 92 | - (id)copyWithZone:(NSZone *)zone{ \ 93 | return _showInstance; \ 94 | } \ 95 | - (id)mutableCopyWithZone:(NSZone *)zone{ \ 96 | return _showInstance; \ 97 | } \ 98 | 99 | 100 | UIKIT_EXTERN const CGFloat EasyShowAnimationTime ;//动画时间 101 | 102 | 103 | 104 | @interface EasyShowUtils : NSObject 105 | 106 | + (CGSize)textWidthWithStirng:(NSString *)string font:(UIFont *)font maxWidth:(CGFloat)maxWidth ; 107 | 108 | + (UIViewController *)easyShowViewTopViewController ; 109 | 110 | + (UIImage *)imageWithColor:(UIColor *)color ; 111 | 112 | @end 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /EasyShowView/EasyShowUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyShowUtils.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyShowUtils.h" 10 | 11 | const CGFloat EasyShowAnimationTime = 0.3f ; //动画时间 12 | 13 | @implementation EasyShowUtils 14 | 15 | + (CGSize)textWidthWithStirng:(NSString *)string font:(UIFont *)font maxWidth:(CGFloat)maxWidth 16 | { 17 | CGSize size = [string boundingRectWithSize:CGSizeMake(maxWidth, SCREEN_HEIGHT_S) 18 | options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine 19 | attributes:@{NSFontAttributeName:font} 20 | context:nil].size; 21 | 22 | if (size.width < 60) { 23 | size.width = 60 ; 24 | } 25 | return size ; 26 | } 27 | 28 | + (UIViewController *)easyShowViewTopViewController { 29 | UIViewController *resultVC = [self tempEasyShowViewTopVC:[[UIApplication sharedApplication].keyWindow rootViewController]]; 30 | while (resultVC.presentedViewController) { 31 | resultVC = [self tempEasyShowViewTopVC:resultVC.presentedViewController]; 32 | } 33 | return resultVC; 34 | } 35 | + (UIViewController *)tempEasyShowViewTopVC:(UIViewController *)vc { 36 | if ([vc isKindOfClass:[UINavigationController class]]) { 37 | return [self tempEasyShowViewTopVC:[(UINavigationController *)vc topViewController]]; 38 | } else if ([vc isKindOfClass:[UITabBarController class]]) { 39 | return [self tempEasyShowViewTopVC:[(UITabBarController *)vc selectedViewController]]; 40 | } else { 41 | return vc; 42 | } 43 | return nil; 44 | } 45 | + (UIImage *)imageWithColor:(UIColor *)color 46 | { 47 | CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 48 | UIGraphicsBeginImageContext(rect.size); 49 | CGContextRef context = UIGraphicsGetCurrentContext(); 50 | CGContextSetFillColorWithColor(context, [color CGColor]); 51 | CGContextFillRect(context, rect); 52 | 53 | UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); 54 | UIGraphicsEndImageContext(); 55 | 56 | return theImage; 57 | } 58 | //+ (UIImageView *)imageViewSetCorner:(UIImageView *)imgView radius:(CGFloat)radius sizetoFit:(CGSize)sizetoFit 59 | //{ 60 | // CGRect rect = CGRectMake(0, 0, sizetoFit.easyS_width, sizetoFit.easyS_height) ; 61 | // 62 | // UIGraphicsBeginImageContextWithOptions(rect.size, false, [UIScreen mainScreen].scale) ; 63 | // CGContextAddPath(UIGraphicsGetCurrentContext(), 64 | // UIBezierPath(roundedRect: rect, byRoundingCorners: UIRectCorner.AllCorners, 65 | // cornerRadii: CGSize(width: radius, height: radius)).CGPath) 66 | // CGContextClip(UIGraphicsGetCurrentContext()) 67 | // 68 | // imgView.drawInRect(rect) ; 69 | // CGContextDrawPath(UIGraphicsGetCurrentContext(), .FillStroke) 70 | // let output = UIGraphicsGetImageFromCurrentImageContext(); 71 | // UIGraphicsEndImageContext(); 72 | //} 73 | //func kt_drawRectWithRoundedCorner(radius radius: CGFloat, _ sizetoFit: CGSize) -> UIImage { 74 | // let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: sizetoFit) 75 | // 76 | // UIGraphicsBeginImageContextWithOptions(rect.size, false, UIScreen.mainScreen().scale) 77 | // CGContextAddPath(UIGraphicsGetCurrentContext(), 78 | // UIBezierPath(roundedRect: rect, byRoundingCorners: UIRectCorner.AllCorners, 79 | // cornerRadii: CGSize(width: radius, height: radius)).CGPath) 80 | // CGContextClip(UIGraphicsGetCurrentContext()) 81 | // 82 | // self.drawInRect(rect) 83 | // CGContextDrawPath(UIGraphicsGetCurrentContext(), .FillStroke) 84 | // let output = UIGraphicsGetImageFromCurrentImageContext(); 85 | // UIGraphicsEndImageContext(); 86 | // 87 | // return output 88 | //} 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /EasyShowView/EasyShowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyShowView.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2017/11/30. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #ifndef EasyShowView_h 10 | #define EasyShowView_h 11 | 12 | #import "EasyTextView.h" 13 | #import "EasyLoadingView.h" 14 | #import "EasyAlertView.h" 15 | #import "EasyEmptyView.h" 16 | 17 | 18 | 19 | 20 | #endif /* EasyShowView_h */ 21 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextBgView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextBgView.h 3 | // EFHealth 4 | // 5 | // Created by nf on 16/7/20. 6 | // Copyright © 2016年 ef. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyTextConfig.h" 12 | 13 | @interface EasyTextBgView : UIView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame 16 | status:(ShowTextStatus)status 17 | text:(NSString *)text 18 | imageName:(NSString *)imageName 19 | config:(EasyTextConfig *)config ; 20 | 21 | - (void)showWindowYToPoint:(CGFloat)toPoint ; 22 | 23 | - (void)showStartAnimationWithDuration:(CGFloat)duration ; 24 | - (void)showEndAnimationWithDuration:(CGFloat)duration ; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextBgView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextBgView.m 3 | // EFHealth 4 | // 5 | // Created by nf on 16/7/20. 6 | // Copyright © 2016年 ef. All rights reserved. 7 | // 8 | 9 | #import "EasyTextBgView.h" 10 | 11 | #import "UIView+EasyShowExt.h" 12 | #import "EasyShowUtils.h" 13 | 14 | 15 | @interface EasyTextBgView() 16 | 17 | @property ShowTextStatus showTextStatus ; 18 | 19 | @property (nonatomic,strong)UILabel *textLabel ; 20 | @property (nonatomic,strong)UIImageView *imageView ; 21 | 22 | @property (nonatomic,strong)EasyTextConfig *config ; 23 | 24 | @property (nonatomic,strong)UIWindow *showTextWindow ; 25 | 26 | @end 27 | 28 | @implementation EasyTextBgView 29 | 30 | - (void)dealloc 31 | { 32 | _showTextWindow = nil ; 33 | } 34 | 35 | 36 | - (void)showWindowYToPoint:(CGFloat)toPoint 37 | { 38 | self.showTextWindow.easyS_y = toPoint ; 39 | } 40 | - (instancetype)initWithFrame:(CGRect)frame status:(ShowTextStatus)status text:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *)config 41 | { 42 | if ([super initWithFrame:frame]) { 43 | 44 | _config = config ; 45 | self.backgroundColor = self.config.bgColor ; //[UIColor redColor]; // 46 | 47 | _showTextStatus = status ; 48 | 49 | if ((!(self.isShowedStatusBar||self.isShowedNavigation))) { 50 | 51 | [self setRoundedCorners:10]; 52 | 53 | if (_showTextStatus != ShowTextStatusPureText && (!ISEMPTY_S(text))) {//只要不是纯文字,其他的都需要显示图片 54 | self.imageView.easyS_top = EasyDrawImageEdge ; 55 | } 56 | } 57 | 58 | 59 | if (imageName) { 60 | UIImage *image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 61 | if (image) { 62 | self.imageView.image = image ; 63 | } 64 | else{ 65 | NSAssert(NO, @"iamgeName is illgal "); 66 | } 67 | } 68 | 69 | 70 | 71 | if (!ISEMPTY_S(text)) { 72 | CGSize textSize = [EasyShowUtils textWidthWithStirng:text 73 | font:self.config.titleFont 74 | maxWidth:TextShowMaxWidth]; 75 | 76 | self.textLabel.text = text ; 77 | 78 | 79 | if (self.isShowedStatusBar||self.isShowedNavigation) { 80 | 81 | CGFloat addX = self.isShowedStatusBar ? 7 : 10 ; 82 | CGFloat addH = self.isShowedStatusBar ?: 5; 83 | self.textLabel.frame = CGRectMake(self.imageView.easyS_right + addX , self.imageView.easyS_top - addH, self.easyS_width - self.imageView.easyS_right - 5, self.imageView.easyS_height +addH*2 ) ; 84 | // self.textLabel.backgroundColor = [UIColor yellowColor]; 85 | self.textLabel.textAlignment = NSTextAlignmentLeft ; 86 | } 87 | else{ 88 | 89 | self.textLabel.frame = CGRectMake(20,self.easyS_height-textSize.height-15 ,textSize.width, textSize.height) ; 90 | self.textLabel.textAlignment = NSTextAlignmentCenter ; 91 | } 92 | } 93 | 94 | [self drawAnimationImageView]; 95 | } 96 | return self ; 97 | } 98 | 99 | - (UIWindow *)showTextWindow 100 | { 101 | if (nil == _showTextWindow) { 102 | CGFloat showHeight = self.isShowedStatusBar ? STATUSBAR_HEIGHT_S : NAVIGATION_HEIGHT_S ; 103 | _showTextWindow = [[UIWindow alloc]initWithFrame:CGRectMake(0, -showHeight , SCREEN_WIDTH_S, showHeight )]; 104 | _showTextWindow.backgroundColor = self.config.bgColor ; // [UIColor yellowColor]; // 105 | _showTextWindow.windowLevel = UIWindowLevelAlert; 106 | UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureTap)]; 107 | [_showTextWindow addGestureRecognizer:gesture]; 108 | _showTextWindow.hidden = NO ; 109 | _showTextWindow.alpha = 1; 110 | } 111 | return _showTextWindow ; 112 | } 113 | - (void)gestureTap 114 | { 115 | } 116 | //加载Loading的动画 117 | - (void)drawAnimationImageViewLoading 118 | { 119 | CGPoint centerPoint= CGPointMake(self.imageView.easyS_width/2.0f, self.imageView.easyS_height/2.0f) ; 120 | UIBezierPath *beizPath=[UIBezierPath bezierPathWithArcCenter:centerPoint radius:centerPoint.x startAngle:-M_PI_2 endAngle:M_PI_2 clockwise:YES]; 121 | CAShapeLayer *centerLayer=[CAShapeLayer layer]; 122 | centerLayer.path=beizPath.CGPath; 123 | centerLayer.fillColor=[UIColor clearColor].CGColor;//填充色 124 | centerLayer.strokeColor=self.config.titleColor.CGColor;//边框颜色 125 | centerLayer.lineWidth=2.0f; 126 | centerLayer.lineCap=kCALineCapRound;//线框类型 127 | 128 | [self.imageView.layer addSublayer:centerLayer]; 129 | 130 | [self drawAnimiationImageView:NO]; 131 | } 132 | 133 | // 转圈动画 134 | - (void)drawAnimiationImageView:(BOOL)isImageView 135 | { 136 | NSString *keyPath = isImageView ? @"transform.rotation.y" : @"transform.rotation.z" ; 137 | CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:keyPath]; 138 | animation.fromValue=@(0); 139 | animation.toValue=@(M_PI*2); 140 | animation.duration=isImageView ? 1.3 : .8; 141 | animation.repeatCount=HUGE; 142 | animation.fillMode=kCAFillModeForwards; 143 | animation.removedOnCompletion=NO; 144 | animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 145 | [self.imageView.layer addAnimation:animation forKey:@"animation"]; 146 | } 147 | 148 | - (void)drawAnimationImageView 149 | { 150 | CGFloat imageWH = self.imageView.easyS_width ; 151 | 152 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, imageWH, imageWH) 153 | cornerRadius:imageWH/2]; 154 | UIColor *drawColor = nil ; 155 | switch (_showTextStatus) { 156 | case ShowTextStatusPureText: 157 | return ; 158 | case ShowTextStatusSuccess: 159 | { 160 | CGFloat addHeight = self.config.statusType == TextStatusTypeStatusBar ? 1 : 3 ; 161 | [path moveToPoint:CGPointMake((imageWH-imageWH)/2+imageWH/4, addHeight + imageWH/2)]; 162 | [path addLineToPoint:CGPointMake(imageWH/2, imageWH*3/4)]; 163 | [path addLineToPoint:CGPointMake(imageWH/2 + imageWH*1/3, imageWH*1/3)]; 164 | 165 | drawColor = [UIColor greenColor] ; 166 | } break; 167 | case ShowTextStatusError: 168 | { 169 | [path moveToPoint:CGPointMake(imageWH/2-imageWH/4, imageWH/4)]; 170 | [path addLineToPoint:CGPointMake(imageWH/2+imageWH/4, imageWH*3/4)]; 171 | 172 | [path moveToPoint:CGPointMake(imageWH/2+imageWH/4, imageWH/4)]; 173 | [path addLineToPoint:CGPointMake(imageWH/2-imageWH/4, imageWH*3/4)]; 174 | 175 | drawColor = [UIColor redColor] ; 176 | }break ; 177 | case ShowTextStatusInfo: 178 | { 179 | CGFloat addHeight = self.config.statusType == TextStatusTypeStatusBar ? 5 : 3 ; 180 | [path moveToPoint:CGPointMake(imageWH/2, imageWH/4 )]; 181 | [path addLineToPoint:CGPointMake(imageWH/2,imageWH/4 + addHeight)]; 182 | 183 | [path moveToPoint:CGPointMake(imageWH/2,imageWH/4 + 6)]; 184 | [path addLineToPoint:CGPointMake(imageWH/2, imageWH*3/4 )]; 185 | 186 | drawColor = [UIColor lightGrayColor] ; 187 | }break ; 188 | default: 189 | break; 190 | } 191 | 192 | CAShapeLayer *lineLayer = [ CAShapeLayer layer]; 193 | lineLayer.frame = CGRectZero; 194 | lineLayer.fillColor = [ UIColor clearColor ].CGColor ; 195 | lineLayer.path = path. CGPath ; 196 | lineLayer.strokeColor = self.config.titleColor.CGColor ; 197 | lineLayer.lineWidth = self.isShowedStatusBar ? 1 : 2; 198 | lineLayer.cornerRadius = 50; 199 | 200 | CABasicAnimation *ani = [ CABasicAnimation animationWithKeyPath: @"strokeEnd"]; 201 | ani.fromValue = @0 ; 202 | ani.toValue = @1 ; 203 | ani.duration = 0.4; 204 | [lineLayer addAnimation :ani forKey :@"strokeEnd"]; 205 | 206 | [self.imageView.layer addSublayer :lineLayer]; 207 | } 208 | 209 | - (void)showEndAnimationWithDuration:(CGFloat)duration 210 | { 211 | CABasicAnimation *bacAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 212 | bacAnimation.duration = duration ; 213 | bacAnimation.beginTime = .0; 214 | bacAnimation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.4f :0.3f :0.5f :-0.5f]; 215 | bacAnimation.fromValue = [NSNumber numberWithFloat:1.0f]; 216 | bacAnimation.toValue = [NSNumber numberWithFloat:0.0f]; 217 | 218 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; 219 | animationGroup.animations = @[bacAnimation]; 220 | animationGroup.duration = bacAnimation.duration; 221 | animationGroup.removedOnCompletion = NO; 222 | animationGroup.fillMode = kCAFillModeForwards; 223 | 224 | [self.layer addAnimation:animationGroup forKey:nil]; 225 | } 226 | 227 | - (void)showStartAnimationWithDuration:(CGFloat)duration 228 | { 229 | CAKeyframeAnimation *popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 230 | popAnimation.duration = duration; 231 | popAnimation.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.01f, 0.01f, 1.0f)], 232 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.05f, 1.05f, 1.0f)], 233 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.95f, 0.95f, 1.0f)], 234 | [NSValue valueWithCATransform3D:CATransform3DIdentity]]; 235 | popAnimation.keyTimes = @[@0.2f, @0.5f, @0.75f, @1.0f]; 236 | popAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 237 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 238 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 239 | [self.layer addAnimation:popAnimation forKey:nil]; 240 | } 241 | 242 | #pragma mark - getter 243 | 244 | 245 | //是否显示在statusbar上 246 | - (BOOL)isShowedStatusBar 247 | { 248 | return self.config.statusType==TextStatusTypeStatusBar ; 249 | } 250 | //是否正在显示在navigation上 251 | - (BOOL)isShowedNavigation 252 | { 253 | return self.config.statusType==TextStatusTypeNavigation ; 254 | } 255 | 256 | - (UIImageView *)imageView 257 | { 258 | if (nil == _imageView) { 259 | CGFloat imageWH = EasyDrawImageWH ; 260 | CGFloat imageX = (self.easyS_width-EasyDrawImageWH)/2 ; 261 | CGFloat imageY = EasyDrawImageEdge/2 ; 262 | if (self.isShowedStatusBar) { 263 | imageWH = 15 ; 264 | imageX = 10 ; 265 | imageY = self.easyS_height - imageWH - 2.5 ; 266 | }else if ( self.isShowedNavigation){ 267 | imageX = 10 ; 268 | imageY = (self.easyS_height - imageWH)/2 + (ISIPHONE_X_S ? 20 : 3 ); 269 | } 270 | 271 | _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(imageX,imageY , imageWH, imageWH)]; 272 | _imageView.tintColor = self.config.titleColor ; 273 | // _imageView.backgroundColor = [UIColor yellowColor]; 274 | if ((self.isShowedStatusBar||self.isShowedNavigation)) { 275 | [self.showTextWindow addSubview:_imageView]; 276 | } 277 | else{ 278 | [self addSubview:_imageView]; 279 | } 280 | } 281 | return _imageView ; 282 | } 283 | - (UILabel *)textLabel 284 | { 285 | if (nil == _textLabel) { 286 | _textLabel = [[UILabel alloc]init]; 287 | _textLabel.textColor = self.config.titleColor; 288 | _textLabel.font = self.config.titleFont ; 289 | _textLabel.backgroundColor = [UIColor clearColor]; 290 | _textLabel.textAlignment = NSTextAlignmentCenter ; 291 | _textLabel.numberOfLines = 0 ; 292 | if ((self.isShowedStatusBar||self.isShowedNavigation)) { 293 | [self.showTextWindow addSubview:_textLabel]; 294 | } 295 | else{ 296 | [self addSubview:_textLabel]; 297 | } 298 | } 299 | return _textLabel ; 300 | } 301 | 302 | /* 303 | // Only override drawRect: if you perform custom drawing. 304 | // An empty implementation adversely affects performance during animation. 305 | - (void)drawRect:(CGRect)rect { 306 | // Drawing code 307 | } 308 | */ 309 | 310 | @end 311 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/3. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EasyTextTypes.h" 11 | #import "EasyShowUtils.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface EasyTextConfig : NSObject 16 | 17 | // 显示吐丝所需要的父视图(为空将显示在window上) 18 | @property (nonatomic,strong)UIView *superView ; 19 | 20 | //显示期间,父视图是否接受事件 21 | @property (nonatomic,assign)BOOL superReceiveEvent ; 22 | 23 | // 展示/隐藏 动画类型 24 | @property (nonatomic,assign)TextAnimationType animationType ; 25 | 26 | // 显示吐丝的位置(上、中、下、statusbar上、导航条上) 27 | @property (nonatomic,assign)TextStatusType statusType ; 28 | 29 | //显示文字大小 30 | @property (nonatomic,strong)UIFont *titleFont ; 31 | 32 | // 显示文字颜色 33 | @property (nonatomic,strong)UIColor *titleColor ; 34 | 35 | //显示背景颜色 36 | @property (nonatomic,strong)UIColor *bgColor ; 37 | 38 | // 阴影颜色(为clearcolor的时候不显示阴影) 39 | @property (nonatomic,strong)UIColor *shadowColor ; 40 | 41 | //显示文字的时间 42 | @property (nonatomic,copy) float(^textShowTimeBlock)(NSString *text) ; 43 | 44 | 45 | #pragma mark - 创建对象的简便方法 46 | 47 | + (instancetype)shared ; 48 | 49 | 50 | #pragma mark - 链式编程设置属性(和上面直接设置属性一样) 51 | 52 | - (EasyTextConfig *(^)(UIView *))setSuperView ; 53 | - (EasyTextConfig *(^)(BOOL))setSuperReceiveEvent ; 54 | - (EasyTextConfig *(^)(TextAnimationType))setAnimationType ; 55 | - (EasyTextConfig *(^)(TextStatusType))setStatusType ; 56 | 57 | - (EasyTextConfig *(^)(UIFont *))setTitleFont ; 58 | - (EasyTextConfig *(^)(UIColor *))setTitleColor ; 59 | - (EasyTextConfig *(^)(UIColor *))setBgColor ; 60 | - (EasyTextConfig *(^)(UIColor *))setShadowColor ; 61 | 62 | 63 | #pragma mark - 类方法设置属性(和上面直接设置属性一样) 64 | 65 | /** 66 | * superview 显示所需要的父视图 67 | */ 68 | + (instancetype)configWithSuperView:(UIView *)superView ; 69 | 70 | /** 71 | * superview 显示所需要的父视图 72 | * receive 在显示的期间,superview是否能接接收事件 73 | * animationType 文字展示的动画形式 74 | */ 75 | + (instancetype)configWithSuperView:(UIView *)superView 76 | animationType:(TextAnimationType)animationType ; 77 | 78 | /** 79 | * superview 显示所需要的父视图 80 | * receive 在显示的期间,superview是否能接接收事件 81 | * animationType 文字展示的动画形式 82 | * statusType 文字显示所在的位置 83 | */ 84 | + (instancetype)configWithSuperView:(UIView *)superView 85 | animationType:(TextAnimationType)animationType 86 | statusType:(TextStatusType)statusType ; 87 | 88 | /** 89 | * superview 显示所需要的父视图 90 | * receive 在显示的期间,superview是否能接接收事件 91 | * animationType 文字展示的动画形式 92 | * statusType 文字显示所在的位置 93 | */ 94 | + (instancetype)configWithSuperView:(UIView *)superView 95 | animationType:(TextAnimationType)animationType 96 | statusType:(TextStatusType)statusType 97 | superReceiveEvent:(BOOL)receive ; 98 | 99 | @end 100 | 101 | NS_ASSUME_NONNULL_END 102 | 103 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/3. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyTextConfig.h" 10 | #import "EasyShowUtils.h" 11 | #import "EasyTextGlobalConfig.h" 12 | 13 | @implementation EasyTextConfig 14 | 15 | + (instancetype)shared 16 | { 17 | return [[self alloc]init]; 18 | } 19 | - (instancetype)init 20 | { 21 | if (self = [super init]) { 22 | 23 | EasyTextGlobalConfig *globalC = [EasyTextGlobalConfig shared]; 24 | _superReceiveEvent = globalC.superReceiveEvent ; 25 | _animationType = globalC.animationType ; 26 | _statusType = globalC.statusType ; 27 | } 28 | return self ; 29 | } 30 | 31 | - (EasyTextConfig *(^)(UIView *))setSuperView{ 32 | return ^EasyTextConfig *(UIView *superView){ 33 | self.superView = superView ; 34 | return self ; 35 | } ; 36 | } 37 | - (EasyTextConfig *(^)(TextStatusType))setStatusType{ 38 | return ^EasyTextConfig *(TextStatusType statusType){ 39 | self.statusType = statusType ; 40 | return self ; 41 | } ; 42 | } 43 | - (EasyTextConfig *(^)(TextAnimationType))setAnimationType{ 44 | return ^EasyTextConfig *(TextAnimationType animationType){ 45 | self.animationType = animationType ; 46 | return self ; 47 | }; 48 | } 49 | - (EasyTextConfig *(^)(BOOL))setSuperReceiveEvent{ 50 | return ^EasyTextConfig *(BOOL receive){ 51 | self.superReceiveEvent = receive ; 52 | return self ; 53 | }; 54 | } 55 | - (EasyTextConfig *(^)(UIFont *))setTitleFont { 56 | return ^EasyTextConfig *(UIFont *titleFont){ 57 | self.titleFont = titleFont ; 58 | return self ; 59 | }; 60 | } 61 | - (EasyTextConfig *(^)(UIColor *))setTitleColor{ 62 | return ^EasyTextConfig *(UIColor *titleColor){ 63 | self.titleColor = titleColor ; 64 | return self ; 65 | }; 66 | } 67 | - (EasyTextConfig *(^)(UIColor *))setBgColor{ 68 | return ^EasyTextConfig *(UIColor *bgcolor){ 69 | self.bgColor = bgcolor ; 70 | return self ; 71 | }; 72 | } 73 | - (EasyTextConfig *(^)(UIColor *))setShadowColor{ 74 | return ^EasyTextConfig *(UIColor *shadowColor){ 75 | self.shadowColor = shadowColor ; 76 | return self ; 77 | }; 78 | } 79 | 80 | 81 | 82 | + (instancetype)configWithSuperView:(UIView *)superView 83 | { 84 | return [self configWithSuperView:superView 85 | animationType:TextAnimationTypeUndefine]; 86 | } 87 | 88 | + (instancetype)configWithSuperView:(UIView *)superView 89 | animationType:(TextAnimationType)animationType 90 | { 91 | return [self configWithSuperView:superView 92 | animationType:animationType 93 | statusType:TextStatusTypeUndefine]; 94 | } 95 | 96 | + (instancetype)configWithSuperView:(UIView *)superView 97 | animationType:(TextAnimationType)animationType 98 | statusType:(TextStatusType)statusType 99 | { 100 | return [self configWithSuperView:superView 101 | animationType:animationType 102 | statusType:statusType 103 | superReceiveEvent:[EasyTextGlobalConfig shared].superReceiveEvent]; 104 | } 105 | 106 | + (instancetype)configWithSuperView:(UIView *)superView 107 | animationType:(TextAnimationType)animationType 108 | statusType:(TextStatusType)statusType 109 | superReceiveEvent:(BOOL)receive 110 | { 111 | EasyTextConfig *config = [self shared]; 112 | config.superView = superView ; 113 | config.superReceiveEvent = receive ; 114 | config.animationType = animationType ; 115 | config.statusType = statusType ; 116 | return config ; 117 | } 118 | @end 119 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextGlobalConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextGlobalConfig.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/3. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "EasyTextTypes.h" 11 | #import "EasyShowUtils.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface EasyTextGlobalConfig : NSObject 16 | 17 | // 显示吐丝所需要的父视图(为空将显示在window上) 18 | //@property (nonatomic,strong)UIView *superView UI_APPEARANCE_SELECTOR ; 19 | 20 | //显示期间,父视图是否接受事件 21 | @property (nonatomic,assign)BOOL superReceiveEvent UI_APPEARANCE_SELECTOR ; 22 | 23 | // 展示/隐藏 动画类型 24 | @property (nonatomic,assign)TextAnimationType animationType UI_APPEARANCE_SELECTOR ; 25 | 26 | // 显示吐丝的位置(上、中、下、statusbar上、导航条上) 27 | @property (nonatomic,assign)TextStatusType statusType UI_APPEARANCE_SELECTOR ; 28 | 29 | //显示背景颜色 30 | @property (nonatomic,strong)UIColor *bgColor UI_APPEARANCE_SELECTOR ; 31 | 32 | //显示文字大小 33 | @property (nonatomic,strong)UIFont *titleFont UI_APPEARANCE_SELECTOR ; 34 | 35 | // 显示文字颜色 36 | @property (nonatomic,strong)UIColor *titleColor UI_APPEARANCE_SELECTOR ; 37 | 38 | // 阴影颜色(为clearcolor的时候不显示阴影) 39 | @property (nonatomic,strong)UIColor *shadowColor UI_APPEARANCE_SELECTOR; 40 | 41 | //显示文字的时间 42 | @property (nonatomic,copy) float(^textShowTimeBlock)(NSString *text) UI_APPEARANCE_SELECTOR ; 43 | 44 | // 吐丝是否系那是到window上,默认为YES 。(如果设置为NO:将显示到最顶层controller上) ---> window和controller的区别。当push到下一个控制器的时候,会不会还在系那是 45 | @property (nonatomic,assign)BOOL showOnWindow UI_APPEARANCE_SELECTOR ; 46 | 47 | easyShowView_singleton_interface 48 | 49 | 50 | /** 51 | * 是否已经使用了globalConfig,库内部使用 52 | */ 53 | + (BOOL)isUseTextGlobalConfig ; 54 | 55 | @end 56 | 57 | NS_ASSUME_NONNULL_END 58 | 59 | 60 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextGlobalConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextGlobalConfig.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2018/3/3. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyTextGlobalConfig.h" 10 | 11 | @implementation EasyTextGlobalConfig 12 | 13 | easyShowView_singleton_implementation(EasyTextGlobalConfig) 14 | 15 | - (instancetype)init 16 | { 17 | if (self = [super init]) { 18 | 19 | _showOnWindow = YES ; 20 | _superReceiveEvent = YES ; 21 | 22 | _animationType = TextAnimationTypeBounce ; 23 | _statusType = TextStatusTypeMidden ; 24 | 25 | _titleFont = [UIFont systemFontOfSize:15]; 26 | _titleColor = [[UIColor whiteColor]colorWithAlphaComponent:1.7]; 27 | _bgColor = [UIColor blackColor]; 28 | _shadowColor = [UIColor blueColor]; 29 | 30 | } 31 | return self ; 32 | } 33 | 34 | + (BOOL)isUseTextGlobalConfig 35 | { 36 | return _showInstance!=nil ? YES : NO ; 37 | } 38 | @end 39 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextTypes.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | typedef NS_ENUM(NSInteger, ShowTextStatus) { 14 | 15 | ShowTextStatusPureText ,/** 纯文字 */ 16 | ShowTextStatusSuccess, /** 成功 */ 17 | ShowTextStatusError, /** 失败 */ 18 | ShowTextStatusInfo, /** 提示 */ 19 | ShowTextStatusImage, /** 自定义图片 */ 20 | }; 21 | 22 | /** 23 | * 设置文字的位置 24 | */ 25 | typedef NS_ENUM(NSInteger , TextStatusType) { 26 | TextStatusTypeUndefine = 0 , /** 未定义 */ 27 | TextStatusTypeTop = 1 , 28 | TextStatusTypeMidden , 29 | TextStatusTypeBottom, 30 | TextStatusTypeStatusBar ,//在statusbar上显示 31 | TextStatusTypeNavigation ,//在navigation上显示 32 | }; 33 | 34 | /** 35 | * 文字展示时的动画类型 36 | */ 37 | typedef NS_ENUM(NSInteger , TextAnimationType) { 38 | TextAnimationTypeUndefine = 0 , /** 未定义 */ 39 | TextAnimationTypeNone ,//无动画 40 | TextAnimationTypeFade,//alpha改变 41 | TextAnimationTypeBounce ,//抖动 42 | }; 43 | 44 | 45 | UIKIT_EXTERN const CGFloat TextShowMaxTime ;//最大的显示时长。显示的时长为字符串长度成比例。但是不会超过设置的此时间长度(默认为6秒) 46 | UIKIT_EXTERN const CGFloat TextShowMaxWidth ;//文字显示的最大宽度 47 | 48 | 49 | UIKIT_EXTERN const CGFloat EasyDrawImageWH ; 50 | UIKIT_EXTERN const CGFloat EasyDrawImageEdge ; 51 | UIKIT_EXTERN const CGFloat EasyTextShowEdge ; 52 | UIKIT_EXTERN const CGFloat EasyShowViewMinWidth ; 53 | 54 | UIKIT_EXTERN NSString *const EasyShowViewDidlDismissNotification; 55 | 56 | 57 | @interface EasyTextTypes : NSObject 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextTypes.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextTypes.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2018/3/13. 6 | // Copyright © 2018年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyTextTypes.h" 10 | 11 | 12 | const CGFloat TextShowMaxTime = 8.0f;//最大的显示时长。显示的时长为字符串长度成比例。但是不会超过设置的此时间长度(默认为6秒) 13 | const CGFloat TextShowMaxWidth = 300;//文字显示的最大宽度 14 | 15 | 16 | const CGFloat EasyDrawImageWH = 30 ; //显示图片的宽高 17 | const CGFloat EasyDrawImageEdge = 15 ; //显示图片的边距 18 | const CGFloat EasyTextShowEdge = 40 ; //显示纯文字时,当设置top和bottom的时候,距离屏幕上下的距离 19 | const CGFloat EasyShowViewMinWidth = 50 ;//视图最小的宽度 20 | 21 | 22 | NSString *const EasyShowViewDidlDismissNotification = @"EasyShowViewDidlDismissNotification" ; //当EasyShowView消失的时候会发送此通知。 23 | 24 | 25 | @implementation EasyTextTypes 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextView.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/12/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EasyTextConfig.h" 12 | 13 | @interface EasyTextView : UIView 14 | 15 | /** 16 | * 显示一个纯文字消息 (config:显示属性设置,可省略) 17 | */ 18 | + (void)showText:(NSString *)text ; 19 | + (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 20 | 21 | /** 22 | * 显示一个成功消息(config:显示属性设置) 23 | */ 24 | + (void)showSuccessText:(NSString *)text ; 25 | + (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 26 | 27 | /** 28 | * 显示一个错误消息(config:显示属性设置) 29 | */ 30 | + (void)showErrorText:(NSString *)text ; 31 | + (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 32 | 33 | /** 34 | * 显示一个提示消息(config:显示属性设置) 35 | */ 36 | + (void)showInfoText:(NSString *)text ; 37 | + (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 38 | 39 | /** 40 | * 显示一个自定义图片消息(config:显示属性设置) 41 | */ 42 | + (void)showImageText:(NSString *)text imageName:(NSString *)imageName ; 43 | + (void)showImageText:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *(^)(void))config ; 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /EasyShowView/EasyTextView.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyTextView.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/12/14. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "EasyTextView.h" 10 | #import "UIView+EasyShowExt.h" 11 | 12 | #import "EasyTextBgView.h" 13 | 14 | #import "EasyTextGlobalConfig.h" 15 | 16 | @interface EasyTextView() 17 | 18 | @property (nonatomic,strong)NSString *showText ;//展示的文字 19 | @property (nonatomic,strong)NSString *showImageName ;//展示的图片 20 | @property (nonatomic,assign)ShowTextStatus showTextStatus ;//展示的类型 21 | @property (nonatomic,strong)EasyTextConfig *showTextConfig ;//配置信息 22 | 23 | @property (nonatomic,assign)BOOL isShowOnStatusBar ; 24 | @property (nonatomic,assign)BOOL isShowOnNavigation ; 25 | 26 | @property (nonatomic,strong)EasyTextBgView *showBgView ;//用于放图片和文字的背景 27 | 28 | 29 | - (void)showViewWithSuperView:(UIView *)superView ; 30 | - (void)removeSelfFromSuperView ; 31 | 32 | @property (nonatomic,strong)NSTimer *removeTimer ; 33 | @property CGFloat timerShowTime ;//定时器走动的时间 34 | 35 | @end 36 | 37 | @implementation EasyTextView 38 | 39 | - (void)dealloc 40 | { 41 | 42 | } 43 | 44 | - (instancetype)initWithFrame:(CGRect)frame 45 | { 46 | if (self = [super initWithFrame:frame]) { 47 | self.backgroundColor = [UIColor clearColor]; 48 | } 49 | return self ; 50 | } 51 | 52 | 53 | - (void)showViewWithSuperView:(UIView *)superView 54 | { 55 | //展示视图的frame 56 | CGRect showFrame = [self showRectWithSpuerView:superView] ; 57 | 58 | if (self.showTextConfig.superReceiveEvent) {//父视图能接受事件 59 | //self的大小为显示区域的大小 60 | [self setFrame:CGRectMake((superView.easyS_width-showFrame.size.width)/2, showFrame.origin.y, showFrame.size.width, showFrame.size.height)]; 61 | //显示视图的bgview的frame的位置为{0,0} 62 | showFrame.origin.y = 0 ; 63 | } 64 | else{ 65 | //父视图不能接收-->self的大小应该为superview的大小。来遮盖 66 | [self setFrame: CGRectMake(0, 0, superView.easyS_width, superView.easyS_height)] ; 67 | } 68 | 69 | 70 | self.showBgView = [[EasyTextBgView alloc]initWithFrame:showFrame 71 | status:self.showTextStatus 72 | text:self.showText 73 | imageName:self.showImageName config:self.showTextConfig]; 74 | [self addSubview:self.showBgView]; 75 | 76 | 77 | [self showSelfToSuperView:superView]; 78 | 79 | if (self.showTextConfig.shadowColor && self.showTextConfig.shadowColor!=[UIColor clearColor]) { 80 | CGFloat afterStart = self.showTextConfig.animationType==TextAnimationTypeBounce ? EasyShowAnimationTime : EasyShowAnimationTime/2 ; 81 | if (afterStart > 0.1) { 82 | afterStart -=0.1 ; 83 | } 84 | dispatch_queue_after_S(afterStart, ^{ 85 | [self showBackgrouldsubLayer]; 86 | }); 87 | } 88 | } 89 | - (void)showBackgrouldsubLayer 90 | { 91 | CALayer *addSubLayer=[CALayer layer]; 92 | addSubLayer.frame= self.showBgView.frame; 93 | addSubLayer.cornerRadius=8; 94 | addSubLayer.backgroundColor=self.showTextConfig.bgColor.CGColor; 95 | addSubLayer.masksToBounds=NO; 96 | addSubLayer.name = @"backgrouldsubLayer"; 97 | addSubLayer.shadowColor = self.showTextConfig.shadowColor.CGColor; 98 | addSubLayer.shadowOffset = CGSizeMake(0.5,1); 99 | addSubLayer.shadowOpacity = 0.6; 100 | addSubLayer.shadowRadius = 3; 101 | [self.layer insertSublayer:addSubLayer below:self.showBgView.layer]; 102 | } 103 | - (void)hiddenBackgrouldsubLayer 104 | { 105 | for (CALayer *subLayer in self.layer.sublayers) { 106 | if ([subLayer.name isEqualToString:@"backgrouldsubLayer"]) { 107 | [subLayer removeFromSuperlayer]; 108 | break ; 109 | } 110 | } 111 | } 112 | 113 | - (void)showSelfToSuperView:(UIView *)superView 114 | { 115 | switch (self.showTextConfig.animationType) { 116 | case TextAnimationTypeNone: 117 | { 118 | if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { 119 | self.easyS_y = 0 ; 120 | [self.showBgView showWindowYToPoint:0]; 121 | 122 | [superView addSubview:self]; 123 | 124 | } 125 | else{ 126 | // self.alpha = 0.1 ; 127 | // [UIView animateWithDuration:EasyShowAnimationTime animations:^{ 128 | // self.alpha = 1.0 ; 129 | // } completion:^(BOOL finished) { 130 | [superView addSubview:self]; 131 | // }]; 132 | } 133 | }break; 134 | case TextAnimationTypeFade: 135 | { 136 | if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { 137 | self.easyS_y = 0 ; 138 | [self.showBgView showWindowYToPoint:0]; 139 | 140 | [superView addSubview:self]; 141 | } 142 | else{ 143 | self.alpha = 0.1 ; 144 | [UIView animateWithDuration:EasyShowAnimationTime animations:^{ 145 | self.alpha = 1.0 ; 146 | } completion:^(BOOL finished) { 147 | }]; 148 | [superView addSubview:self]; 149 | } 150 | }break ; 151 | case TextAnimationTypeBounce: 152 | { 153 | if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { 154 | self.easyS_y = - self.easyS_height ; 155 | [UIView animateWithDuration:EasyShowAnimationTime animations:^{ 156 | self.easyS_y = 0 ; 157 | [self.showBgView showWindowYToPoint:0]; 158 | }] ; 159 | } 160 | else{ 161 | [self.showBgView showStartAnimationWithDuration:EasyShowAnimationTime]; 162 | } 163 | 164 | [superView addSubview:self]; 165 | }break ; 166 | default: 167 | break; 168 | } 169 | 170 | } 171 | - (void)removeSelfFromSuperView 172 | { 173 | 174 | //移除阴影 175 | if (self.showTextConfig.shadowColor && self.showTextConfig.shadowColor!=[UIColor clearColor]) { 176 | dispatch_queue_after_S(0.1, ^{ 177 | [self hiddenBackgrouldsubLayer]; 178 | }); 179 | } 180 | 181 | switch (self.showTextConfig.animationType) { 182 | case TextAnimationTypeNone: 183 | { 184 | [self removeFromSuperview]; 185 | }break ; 186 | case TextAnimationTypeFade: 187 | { 188 | [UIView animateWithDuration:EasyShowAnimationTime animations:^{ 189 | self.alpha = 0.1 ; 190 | }completion:^(BOOL finished) { 191 | [self removeFromSuperview]; 192 | }] ; 193 | }break ; 194 | case TextAnimationTypeBounce: 195 | { 196 | 197 | if ( (self.isShowOnStatusBar || self.isShowOnNavigation)) { 198 | 199 | [UIView animateWithDuration:EasyShowAnimationTime animations:^{ 200 | self.easyS_y = -self.easyS_height ; 201 | [self.showBgView showWindowYToPoint:-self.easyS_height ]; 202 | }completion:^(BOOL finished) { 203 | [self removeFromSuperview]; 204 | }] ; 205 | } 206 | else{ 207 | [self.showBgView showEndAnimationWithDuration:EasyShowAnimationTime]; 208 | dispatch_queue_after_S(EasyShowAnimationTime, ^{ 209 | [self removeFromSuperview]; 210 | }); 211 | } 212 | } 213 | break ; 214 | default: 215 | break ; 216 | } 217 | 218 | 219 | } 220 | 221 | + (void)EasyTextViewWithText:(NSString *)text 222 | imageName:(NSString *)imageName 223 | status:(ShowTextStatus)status 224 | config:(EasyTextConfig *(^)(void))config 225 | { 226 | if (status==ShowTextStatusPureText && ISEMPTY_S(text)) {// 227 | NSAssert(NO, @"you should set a text for showView !"); 228 | return ; 229 | } 230 | 231 | NSAssert([NSThread isMainThread], @"needs to be accessed on the main thread."); 232 | 233 | if (![NSThread isMainThread]) { 234 | dispatch_async(dispatch_get_main_queue(), ^(void) { 235 | }); 236 | } 237 | 238 | EasyTextConfig *tempConfig = [self changeConfigWithConfig:config] ; 239 | 240 | //显示之前隐藏还在显示的视图 241 | NSEnumerator *subviewsEnum = [tempConfig.superView.subviews reverseObjectEnumerator]; 242 | for (UIView *subview in subviewsEnum) { 243 | if ([subview isKindOfClass:self]) { 244 | EasyTextView *showView = (EasyTextView *)subview ; 245 | [showView removeSelfFromSuperView]; 246 | } 247 | } 248 | 249 | EasyTextView *showView = [[EasyTextView alloc] initWithFrame:CGRectZero]; 250 | showView.showText = text ; 251 | showView.showImageName = imageName ; 252 | 253 | showView.showTextStatus = status ; 254 | 255 | showView.showTextConfig = tempConfig ; 256 | 257 | showView.timerShowTime = 0 ; 258 | [showView showViewWithSuperView:tempConfig.superView]; 259 | 260 | [showView.removeTimer fire]; 261 | } 262 | 263 | 264 | - (CGRect)showRectWithSpuerView:(UIView *)superView 265 | { 266 | //显示图片的高度。 267 | CGFloat imageH = self.showTextStatus==ShowTextStatusPureText ?:(EasyDrawImageWH + EasyDrawImageEdge) ; 268 | 269 | //显示区域的宽高 270 | CGFloat backGroundH = 0 ; 271 | CGFloat backGroundW = SCREEN_WIDTH_S ; 272 | switch (self.showTextConfig.statusType) { 273 | case TextStatusTypeStatusBar://如果是在statusbar上,则高固定,不需要计算 274 | backGroundH = STATUSBAR_HEIGHT_S ; 275 | break; 276 | case TextStatusTypeNavigation: 277 | backGroundH = NAVIGATION_HEIGHT_S ; 278 | break ; 279 | default:{ 280 | CGSize textSize = CGSizeZero ; 281 | if (!ISEMPTY_S(self.showText)) { 282 | textSize = [EasyShowUtils textWidthWithStirng:self.showText 283 | font:self.showTextConfig.titleFont 284 | maxWidth:TextShowMaxWidth]; 285 | } 286 | backGroundH = (textSize.height?(textSize.height+30):0) + imageH ; 287 | backGroundW = textSize.width?(textSize.width+40):0 ; 288 | 289 | if (backGroundW < EasyShowViewMinWidth) { 290 | backGroundW = EasyShowViewMinWidth ; 291 | } 292 | } break; 293 | } 294 | 295 | //显示区域的y值 296 | CGFloat showFrameY = (superView.easyS_height-backGroundH)/2 ;//默认显示在中间 297 | // if (self.showTextStatus != ShowStatusLoading) { 298 | switch (self.showTextConfig.statusType ) { 299 | case TextStatusTypeNavigation: 300 | case TextStatusTypeStatusBar: 301 | showFrameY = 0 ; 302 | break ; 303 | case TextStatusTypeTop: 304 | showFrameY = NAVIGATION_HEIGHT_S + EasyTextShowEdge ; 305 | break; 306 | case TextStatusTypeBottom: 307 | showFrameY = SCREEN_HEIGHT_S - backGroundH - EasyTextShowEdge ; 308 | break ; 309 | default: break; 310 | } 311 | // } 312 | 313 | //显示区域的frame 314 | CGRect showFrame = CGRectMake(0, showFrameY, backGroundW, backGroundH); 315 | 316 | if (!self.showTextConfig.superReceiveEvent) { 317 | showFrame.origin = CGPointMake((superView.easyS_width-backGroundW)/2, showFrameY) ; 318 | } 319 | 320 | return showFrame ; 321 | } 322 | 323 | 324 | 325 | - (void)timerAction 326 | { 327 | if (_timerShowTime >= self.showTextConfig.textShowTimeBlock(self.showText) ) { 328 | //移除定时器 329 | _timerShowTime = 0 ; 330 | if (_removeTimer) { 331 | [_removeTimer invalidate]; 332 | _removeTimer = nil ; 333 | } 334 | //移除自己 335 | [self removeSelfFromSuperView]; 336 | } 337 | _timerShowTime++ ; 338 | } 339 | - (NSTimer *)removeTimer 340 | { 341 | if (nil == _removeTimer) { 342 | _removeTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerAction) userInfo:nil repeats:YES]; 343 | [[NSRunLoop currentRunLoop] addTimer:_removeTimer forMode:NSRunLoopCommonModes]; 344 | } 345 | return _removeTimer ; 346 | } 347 | 348 | 349 | #pragma mark - getter 350 | //是否显示在statusbar上 351 | - (BOOL)isShowOnStatusBar 352 | { 353 | return self.showTextConfig.statusType==TextStatusTypeStatusBar ; 354 | } 355 | //是否正在显示在navigation上 356 | - (BOOL)isShowOnNavigation 357 | { 358 | return self.showTextConfig.statusType==TextStatusTypeNavigation ; 359 | } 360 | 361 | #pragma - 工具 362 | 363 | + (EasyTextConfig *)changeConfigWithConfig:(EasyTextConfig *(^)(void))config 364 | { 365 | 366 | EasyTextConfig *tempConfig = config ? config() : nil ; 367 | if (!tempConfig) { 368 | tempConfig = [EasyTextConfig shared] ; 369 | } 370 | EasyTextGlobalConfig *globalConfig = [EasyTextGlobalConfig shared]; 371 | 372 | if (!tempConfig.superView) { 373 | if (globalConfig.showOnWindow) { 374 | tempConfig.superView = kEasyShowKeyWindow ; 375 | } 376 | else{ 377 | tempConfig.superView = [EasyShowUtils easyShowViewTopViewController].view; 378 | } 379 | } 380 | 381 | if (tempConfig.animationType == TextAnimationTypeUndefine) { 382 | tempConfig.animationType = globalConfig.animationType ; 383 | } 384 | if (tempConfig.statusType == TextStatusTypeUndefine) { 385 | tempConfig.statusType = globalConfig.statusType ; 386 | } 387 | if (!tempConfig.titleFont) { 388 | tempConfig.titleFont = globalConfig.titleFont ; 389 | } 390 | if (!tempConfig.titleColor) { 391 | tempConfig.titleColor = globalConfig.titleColor ; 392 | } 393 | if (!tempConfig.bgColor) { 394 | tempConfig.bgColor = globalConfig.bgColor ; 395 | } 396 | if (!tempConfig.shadowColor) { 397 | tempConfig.shadowColor = globalConfig.shadowColor ; 398 | } 399 | 400 | if (!tempConfig.textShowTimeBlock) { 401 | 402 | if (globalConfig.textShowTimeBlock) { 403 | tempConfig.textShowTimeBlock = globalConfig.textShowTimeBlock ; 404 | }else{ 405 | float(^textShowTime)(NSString *text) = ^float(NSString *text){ 406 | CGFloat time = 1 + text.length*0.15 ; 407 | if (time > TextShowMaxTime) { 408 | time = TextShowMaxTime ; 409 | } 410 | if (time < 2) { 411 | time = 2 ; 412 | } 413 | return time ; 414 | }; 415 | tempConfig.textShowTimeBlock = textShowTime ; 416 | } 417 | } 418 | return tempConfig ; 419 | } 420 | 421 | 422 | #pragma mark - 类方法 423 | 424 | + (void)showText:(NSString *)text 425 | { 426 | EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ 427 | return [EasyTextConfig shared] ; 428 | }; 429 | [self showText:text config:configTemp]; 430 | } 431 | + (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config 432 | { 433 | [self EasyTextViewWithText:text 434 | imageName:nil 435 | status:ShowTextStatusPureText 436 | config:config]; 437 | } 438 | 439 | 440 | + (void)showSuccessText:(NSString *)text 441 | { 442 | EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ 443 | return [EasyTextConfig shared] ; 444 | }; 445 | [self showSuccessText:text config:configTemp]; 446 | } 447 | + (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config 448 | { 449 | [self EasyTextViewWithText:text 450 | imageName:nil 451 | status:ShowTextStatusSuccess 452 | config:config]; 453 | } 454 | 455 | 456 | + (void)showErrorText:(NSString *)text 457 | { 458 | EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ 459 | return [EasyTextConfig shared] ; 460 | }; 461 | [self showErrorText:text config:configTemp]; 462 | } 463 | + (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config 464 | { 465 | [self EasyTextViewWithText:text 466 | imageName:nil 467 | status:ShowTextStatusError 468 | config:config]; 469 | } 470 | 471 | 472 | + (void)showInfoText:(NSString *)text 473 | { 474 | EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ 475 | return [EasyTextConfig shared] ; 476 | }; 477 | [self showInfoText:text config:configTemp]; 478 | } 479 | + (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config 480 | { 481 | [self EasyTextViewWithText:text 482 | imageName:nil 483 | status:ShowTextStatusInfo 484 | config:config]; 485 | } 486 | 487 | 488 | + (void)showImageText:(NSString *)text imageName:(NSString *)imageName 489 | { 490 | EasyTextConfig *(^configTemp)(void) = ^EasyTextConfig *{ 491 | return [EasyTextConfig shared] ; 492 | }; 493 | [self showImageText:text imageName:imageName config:configTemp] ; 494 | } 495 | + (void)showImageText:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *(^)(void))config 496 | { 497 | [self EasyTextViewWithText:text 498 | imageName:imageName 499 | status:ShowTextStatusImage 500 | config:config]; 501 | } 502 | 503 | 504 | @end 505 | -------------------------------------------------------------------------------- /EasyShowView/UIView+EasyShowExt.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+EasyShowExt.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | 13 | /** 14 | * 已iPhone5为标准,宽高都等比例缩放 15 | * 16 | * 4/4s 3.5寸 320*480 17 | * 5/5s/se 4寸 320*568 18 | * 6/6s/7/8 4.7寸 375*667 19 | * 6p/6ps/7p/8p 5.5寸 414*736 20 | * iPhonex 5.8寸 375*812 21 | */ 22 | 23 | @interface UIView (EasyShowExt) 24 | 25 | @property(nonatomic) CGFloat easyS_x; 26 | @property(nonatomic) CGFloat easyS_y; 27 | @property(nonatomic) CGFloat easyS_width; 28 | @property(nonatomic) CGFloat easyS_height; 29 | 30 | @property(nonatomic) CGFloat easyS_centerX; 31 | @property(nonatomic) CGFloat easyS_centerY; 32 | 33 | @property(nonatomic) CGFloat easyS_left; 34 | @property(nonatomic) CGFloat easyS_top; 35 | @property(nonatomic) CGFloat easyS_right; 36 | @property(nonatomic) CGFloat easyS_bottom; 37 | 38 | 39 | - (void)setRoundedCorners:(CGFloat)corners ; 40 | 41 | - (void)setRoundedCorners:(UIRectCorner)corners 42 | borderWidth:(CGFloat)borderWidth 43 | borderColor:(UIColor *)borderColor 44 | cornerSize:(CGSize)size ; 45 | @end 46 | -------------------------------------------------------------------------------- /EasyShowView/UIView+EasyShowExt.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+EasyShowExt.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "UIView+EasyShowExt.h" 10 | 11 | #import "EasyShowUtils.h" 12 | 13 | @implementation UIView (EasyShowExt) 14 | 15 | - (CGFloat)easyS_x { 16 | return self.frame.origin.x; 17 | } 18 | - (void)setEasyS_x:(CGFloat)easyS_x { 19 | CGRect frame = self.frame; 20 | frame.origin.x = easyS_x; 21 | self.frame = frame; 22 | } 23 | - (CGFloat)easyS_y { 24 | return self.frame.origin.y; 25 | } 26 | - (void)setEasyS_y:(CGFloat)easyS_y { 27 | CGRect frame = self.frame; 28 | frame.origin.y = easyS_y; 29 | self.frame = frame; 30 | } 31 | - (CGFloat)easyS_width { 32 | return self.frame.size.width; 33 | } 34 | 35 | - (void)setEasyS_width:(CGFloat)easyS_width { 36 | CGRect frame = self.frame; 37 | frame.size.width = easyS_width; 38 | self.frame = frame; 39 | } 40 | 41 | - (CGFloat)easyS_height { 42 | return self.frame.size.height; 43 | } 44 | 45 | - (void)setEasyS_height:(CGFloat)easyS_height { 46 | CGRect frame = self.frame; 47 | frame.size.height = easyS_height; 48 | self.frame = frame; 49 | } 50 | 51 | 52 | - (CGFloat)easyS_centerX { 53 | return self.center.x; 54 | } 55 | 56 | - (void)setEasyS_centerX:(CGFloat)easyS_centerX{ 57 | self.center = CGPointMake(easyS_centerX, self.center.y); 58 | } 59 | 60 | - (CGFloat)easyS_centerY { 61 | return self.center.y; 62 | } 63 | 64 | - (void)setEasyS_centerY:(CGFloat)easyS_centerY { 65 | self.center = CGPointMake(self.center.x, easyS_centerY); 66 | } 67 | 68 | 69 | 70 | - (CGFloat)easyS_left { 71 | return self.frame.origin.x; 72 | } 73 | 74 | - (void)setEasyS_left:(CGFloat)easyS_left { 75 | CGRect frame = self.frame; 76 | frame.origin.x = easyS_left; 77 | self.frame = frame; 78 | } 79 | 80 | - (CGFloat)easyS_top { 81 | return self.frame.origin.y; 82 | } 83 | 84 | - (void)setEasyS_top:(CGFloat)easyS_top { 85 | CGRect frame = self.frame; 86 | frame.origin.y = easyS_top; 87 | self.frame = frame; 88 | } 89 | 90 | - (CGFloat)easyS_right { 91 | return self.frame.origin.x + self.frame.size.width; 92 | } 93 | 94 | - (void)setEasyS_right:(CGFloat)easyS_right { 95 | CGRect frame = self.frame; 96 | frame.origin.x = easyS_right - frame.size.width; 97 | self.frame = frame; 98 | } 99 | 100 | - (CGFloat)easyS_bottom { 101 | return self.frame.origin.y + self.frame.size.height; 102 | } 103 | 104 | - (void)setEasyS_bottom:(CGFloat)easyS_bottom { 105 | CGRect frame = self.frame; 106 | frame.origin.y = easyS_bottom - frame.size.height; 107 | self.frame = frame; 108 | } 109 | 110 | 111 | - (void)setRoundedCorners:(CGFloat)corners 112 | { 113 | 114 | UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(corners, 0)]; 115 | CAShapeLayer* shapeLayer = [CAShapeLayer layer]; 116 | shapeLayer.frame = self.bounds; 117 | shapeLayer.path = maskPath.CGPath; 118 | 119 | self.layer.mask = shapeLayer ; 120 | } 121 | 122 | - (void)setRoundedCorners:(UIRectCorner)corners 123 | borderWidth:(CGFloat)borderWidth 124 | borderColor:(UIColor *)borderColor 125 | cornerSize:(CGSize)size 126 | { 127 | UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds 128 | byRoundingCorners:corners 129 | cornerRadii:size]; 130 | 131 | CAShapeLayer* maskLayer = [CAShapeLayer layer]; 132 | maskLayer.fillColor = [UIColor blueColor].CGColor; 133 | maskLayer.frame = self.bounds; 134 | maskLayer.path = maskPath.CGPath; 135 | 136 | self.layer.mask = maskLayer; 137 | 138 | if (borderWidth > 0) { 139 | CAShapeLayer *borderLayer = [CAShapeLayer layer]; 140 | 141 | // 用贝赛尔曲线画线,path 其实是在线的中间,这样会被 layer.mask(遮罩层)遮住一半,故在 halfWidth 处新建 path,刚好产生一个内描边 142 | CGFloat halfWidth = borderWidth / 2.0f; 143 | CGRect f = CGRectMake(halfWidth, halfWidth, CGRectGetWidth(self.bounds) - borderWidth, CGRectGetHeight(self.bounds) - borderWidth); 144 | 145 | borderLayer.path = [UIBezierPath bezierPathWithRoundedRect:f byRoundingCorners:corners cornerRadii:size].CGPath; 146 | borderLayer.fillColor = [UIColor clearColor].CGColor; 147 | borderLayer.strokeColor = borderColor.CGColor; 148 | borderLayer.lineWidth = borderWidth; 149 | borderLayer.frame = CGRectMake(0, 0, CGRectGetWidth(f), CGRectGetHeight(f)); 150 | [self.layer addSublayer:borderLayer]; 151 | } 152 | } 153 | @end 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/project.xcworkspace/xcuserdata/Mr_Chen.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo.xcodeproj/project.xcworkspace/xcuserdata/Mr_Chen.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/project.xcworkspace/xcuserdata/nf.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo.xcodeproj/project.xcworkspace/xcuserdata/nf.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/xcuserdata/Mr_Chen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/xcuserdata/Mr_Chen.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EasyShowViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/xcuserdata/nf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 88 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /EasyShowViewDemo.xcodeproj/xcuserdata/nf.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EasyShowViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /EasyShowViewDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/.DS_Store -------------------------------------------------------------------------------- /EasyShowViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. 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 | -------------------------------------------------------------------------------- /EasyShowViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | #import 12 | 13 | 14 | #import "EasyTextGlobalConfig.h" 15 | #import "EasyLoadingGlobalConfig.h" 16 | #import "EasyEmptyGlobalConfig.h" 17 | #import "EasyAlertGlobalConfig.h" 18 | 19 | @interface AppDelegate () 20 | 21 | @end 22 | 23 | @implementation AppDelegate 24 | 25 | 26 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 27 | { 28 | 29 | /**显示文字**/ 30 | EasyTextGlobalConfig *config = [EasyTextGlobalConfig shared]; 31 | config.bgColor = [UIColor whiteColor]; 32 | config.titleColor = [UIColor blackColor]; 33 | 34 | 35 | /**显示加载框**/ 36 | EasyLoadingGlobalConfig *LoadingConfig = [EasyLoadingGlobalConfig shared]; 37 | LoadingConfig.LoadingType = LoadingAnimationTypeFade ; 38 | NSMutableArray *tempArr = [NSMutableArray arrayWithCapacity:8]; 39 | for (int i = 0; i < 9; i++) { 40 | UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"icon_hud_%d",i+1]]; 41 | [tempArr addObject:img] ; 42 | } 43 | LoadingConfig.playImagesArray = tempArr ; 44 | 45 | 46 | /**显示空白页面**/ 47 | EasyEmptyGlobalConfig *emptyConfig = [EasyEmptyGlobalConfig shared]; 48 | emptyConfig.bgColor = [UIColor groupTableViewBackgroundColor]; 49 | 50 | 51 | /**显示alert**/ 52 | EasyAlertGlobalConfig *alertConfig = [EasyAlertGlobalConfig shared]; 53 | alertConfig.titleColor = [UIColor blackColor]; 54 | 55 | 56 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[ViewController new]]; 57 | self.window.rootViewController = nav ; 58 | 59 | // Override point for customization after application launch. 60 | [self setupBugly]; 61 | return YES; 62 | } 63 | 64 | 65 | - (void)setupBugly { 66 | BuglyConfig * config = [[BuglyConfig alloc] init]; 67 | config.debugMode = YES; 68 | config.blockMonitorEnable = YES; 69 | config.blockMonitorTimeout = 1.5; 70 | config.viewControllerTrackingEnable = NO; 71 | config.consolelogEnable = NO ; 72 | [Bugly startWithAppId:@"f4f0a9a873" 73 | developmentDevice:YES 74 | config:config]; 75 | 76 | [Bugly setUserIdentifier:[NSString stringWithFormat:@"User: %@", [UIDevice currentDevice].identifierForVendor]]; 77 | } 78 | 79 | - (void)applicationWillResignActive:(UIApplication *)application { 80 | // 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. 81 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 82 | } 83 | 84 | 85 | - (void)applicationDidEnterBackground:(UIApplication *)application { 86 | // 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. 87 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 88 | } 89 | 90 | 91 | - (void)applicationWillEnterForeground:(UIApplication *)application { 92 | // 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. 93 | } 94 | 95 | 96 | - (void)applicationDidBecomeActive:(UIApplication *)application { 97 | // 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. 98 | } 99 | 100 | 101 | - (void)applicationWillTerminate:(UIApplication *)application { 102 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 103 | } 104 | 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /EasyShowViewDemo/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 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_1.imageset/icon_hud_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_1.imageset/icon_hud_1@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_2@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_2.imageset/icon_hud_2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_2.imageset/icon_hud_2@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_3@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_3.imageset/icon_hud_3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_3.imageset/icon_hud_3@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_4@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_4.imageset/icon_hud_4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_4.imageset/icon_hud_4@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_5@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_5.imageset/icon_hud_5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_5.imageset/icon_hud_5@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_6@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_6.imageset/icon_hud_6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_6.imageset/icon_hud_6@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_7@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_7.imageset/icon_hud_7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_7.imageset/icon_hud_7@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_8@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_8.imageset/icon_hud_8@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_8.imageset/icon_hud_8@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon_hud_9@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_9.imageset/icon_hud_9@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icom_hud/icon_hud_9.imageset/icon_hud_9@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/netError.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "netError@2x.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/netError.imageset/netError@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icon_empty/netError.imageset/netError@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/noNetFlags.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "noNetFlags@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/noNetFlags.imageset/noNetFlags@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icon_empty/noNetFlags.imageset/noNetFlags@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/nodata_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "nodata_icon@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /EasyShowViewDemo/Assets.xcassets/icon_empty/nodata_icon.imageset/nodata_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Assets.xcassets/icon_empty/nodata_icon.imageset/nodata_icon@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/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 | 33 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /EasyShowViewDemo/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 | -------------------------------------------------------------------------------- /EasyShowViewDemo/Bugly.framework/Bugly: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/Bugly.framework/Bugly -------------------------------------------------------------------------------- /EasyShowViewDemo/Bugly.framework/Headers/Bugly.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bugly.h 3 | // 4 | // Version: 2.5(0) 5 | // 6 | // Copyright (c) 2017年 Tencent. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "BuglyConfig.h" 12 | #import "BuglyLog.h" 13 | 14 | BLY_START_NONNULL 15 | 16 | @interface Bugly : NSObject 17 | 18 | /** 19 | * 初始化Bugly,使用默认BuglyConfig 20 | * 21 | * @param appId 注册Bugly分配的应用唯一标识 22 | */ 23 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId; 24 | 25 | /** 26 | * 使用指定配置初始化Bugly 27 | * 28 | * @param appId 注册Bugly分配的应用唯一标识 29 | * @param config 传入配置的 BuglyConfig 30 | */ 31 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId 32 | config:(BuglyConfig * BLY_NULLABLE)config; 33 | 34 | /** 35 | * 使用指定配置初始化Bugly 36 | * 37 | * @param appId 注册Bugly分配的应用唯一标识 38 | * @param development 是否开发设备 39 | * @param config 传入配置的 BuglyConfig 40 | */ 41 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId 42 | developmentDevice:(BOOL)development 43 | config:(BuglyConfig * BLY_NULLABLE)config; 44 | 45 | /** 46 | * 设置用户标识 47 | * 48 | * @param userId 用户标识 49 | */ 50 | + (void)setUserIdentifier:(NSString *)userId; 51 | 52 | /** 53 | * 更新版本信息 54 | * 55 | * @param version 应用版本信息 56 | */ 57 | + (void)updateAppVersion:(NSString *)version; 58 | 59 | /** 60 | * 设置关键数据,随崩溃信息上报 61 | * 62 | * @param value KEY 63 | * @param key VALUE 64 | */ 65 | + (void)setUserValue:(NSString *)value 66 | forKey:(NSString *)key; 67 | 68 | /** 69 | * 获取关键数据 70 | * 71 | * @return 关键数据 72 | */ 73 | + (NSDictionary * BLY_NULLABLE)allUserValues; 74 | 75 | /** 76 | * 设置标签 77 | * 78 | * @param tag 标签ID,可在网站生成 79 | */ 80 | + (void)setTag:(NSUInteger)tag; 81 | 82 | /** 83 | * 获取当前设置标签 84 | * 85 | * @return 当前标签ID 86 | */ 87 | + (NSUInteger)currentTag; 88 | 89 | /** 90 | * 获取设备ID 91 | * 92 | * @return 设备ID 93 | */ 94 | + (NSString *)buglyDeviceId; 95 | 96 | /** 97 | * 上报自定义Objective-C异常 98 | * 99 | * @param exception 异常信息 100 | */ 101 | + (void)reportException:(NSException *)exception; 102 | 103 | /** 104 | * 上报错误 105 | * 106 | * @param error 错误信息 107 | */ 108 | + (void)reportError:(NSError *)error; 109 | 110 | /** 111 | * @brief 上报自定义错误 112 | * 113 | * @param category 类型(Cocoa=3,CSharp=4,JS=5,Lua=6) 114 | * @param aName 名称 115 | * @param aReason 错误原因 116 | * @param aStackArray 堆栈 117 | * @param info 附加数据 118 | * @param terminate 上报后是否退出应用进程 119 | */ 120 | + (void)reportExceptionWithCategory:(NSUInteger)category 121 | name:(NSString *)aName 122 | reason:(NSString *)aReason 123 | callStack:(NSArray *)aStackArray 124 | extraInfo:(NSDictionary *)info 125 | terminateApp:(BOOL)terminate; 126 | 127 | /** 128 | * SDK 版本信息 129 | * 130 | * @return SDK版本号 131 | */ 132 | + (NSString *)sdkVersion; 133 | 134 | /** 135 | * App 是否发生了连续闪退 136 | * 如果 启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退 137 | * 138 | * @return 是否连续闪退 139 | */ 140 | + (BOOL)isAppCrashedOnStartUpExceedTheLimit; 141 | 142 | BLY_END_NONNULL 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /EasyShowViewDemo/Bugly.framework/Headers/BuglyConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // BuglyConfig.h 3 | // Bugly 4 | // 5 | // Copyright (c) 2016年 Tencent. All rights reserved. 6 | // 7 | 8 | #pragma once 9 | 10 | #define BLY_UNAVAILABLE(x) __attribute__((unavailable(x))) 11 | 12 | #if __has_feature(nullability) 13 | #define BLY_NONNULL __nonnull 14 | #define BLY_NULLABLE __nullable 15 | #define BLY_START_NONNULL _Pragma("clang assume_nonnull begin") 16 | #define BLY_END_NONNULL _Pragma("clang assume_nonnull end") 17 | #else 18 | #define BLY_NONNULL 19 | #define BLY_NULLABLE 20 | #define BLY_START_NONNULL 21 | #define BLY_END_NONNULL 22 | #endif 23 | 24 | #import 25 | 26 | #import "BuglyLog.h" 27 | 28 | BLY_START_NONNULL 29 | 30 | @protocol BuglyDelegate 31 | 32 | @optional 33 | /** 34 | * 发生异常时回调 35 | * 36 | * @param exception 异常信息 37 | * 38 | * @return 返回需上报记录,随异常上报一起上报 39 | */ 40 | - (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception; 41 | 42 | @end 43 | 44 | @interface BuglyConfig : NSObject 45 | 46 | /** 47 | * SDK Debug信息开关, 默认关闭 48 | */ 49 | @property (nonatomic, assign) BOOL debugMode; 50 | 51 | /** 52 | * 设置自定义渠道标识 53 | */ 54 | @property (nonatomic, copy) NSString *channel; 55 | 56 | /** 57 | * 设置自定义版本号 58 | */ 59 | @property (nonatomic, copy) NSString *version; 60 | 61 | /** 62 | * 设置自定义设备唯一标识 63 | */ 64 | @property (nonatomic, copy) NSString *deviceIdentifier; 65 | 66 | /** 67 | * 卡顿监控开关,默认关闭 68 | */ 69 | @property (nonatomic) BOOL blockMonitorEnable; 70 | 71 | /** 72 | * 卡顿监控判断间隔,单位为秒 73 | */ 74 | @property (nonatomic) NSTimeInterval blockMonitorTimeout; 75 | 76 | /** 77 | * 设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值) 78 | */ 79 | @property (nonatomic, copy) NSString *applicationGroupIdentifier; 80 | 81 | /** 82 | * 进程内还原开关,默认开启 83 | */ 84 | @property (nonatomic) BOOL symbolicateInProcessEnable; 85 | 86 | /** 87 | * 非正常退出事件记录开关,默认关闭 88 | */ 89 | @property (nonatomic) BOOL unexpectedTerminatingDetectionEnable; 90 | 91 | /** 92 | * 页面信息记录开关,默认开启 93 | */ 94 | @property (nonatomic) BOOL viewControllerTrackingEnable; 95 | 96 | /** 97 | * Bugly Delegate 98 | */ 99 | @property (nonatomic, assign) id delegate; 100 | 101 | /** 102 | * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。 103 | * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志 104 | */ 105 | @property (nonatomic, assign) BuglyLogLevel reportLogLevel; 106 | 107 | /** 108 | * 崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报 109 | * 例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等 110 | */ 111 | @property (nonatomic, copy) NSArray *excludeModuleFilter; 112 | 113 | /** 114 | * 控制台日志上报开关,默认开启 115 | */ 116 | @property (nonatomic, assign) BOOL consolelogEnable; 117 | 118 | /** 119 | * 崩溃退出超时,如果监听到崩溃后,App一直没有退出,则到达超时时间后会自动abort进程退出 120 | * 默认值 5s, 单位 秒 121 | * 当赋值为0时,则不会自动abort进程退出 122 | */ 123 | @property (nonatomic, assign) NSUInteger crashAbortTimeout; 124 | 125 | @end 126 | BLY_END_NONNULL 127 | -------------------------------------------------------------------------------- /EasyShowViewDemo/Bugly.framework/Headers/BuglyLog.h: -------------------------------------------------------------------------------- 1 | // 2 | // BuglyLog.h 3 | // Bugly 4 | // 5 | // Copyright (c) 2017年 Tencent. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | // Log level for Bugly Log 11 | typedef NS_ENUM(NSUInteger, BuglyLogLevel) { 12 | BuglyLogLevelSilent = 0, 13 | BuglyLogLevelError = 1, 14 | BuglyLogLevelWarn = 2, 15 | BuglyLogLevelInfo = 3, 16 | BuglyLogLevelDebug = 4, 17 | BuglyLogLevelVerbose = 5, 18 | }; 19 | #pragma mark - 20 | 21 | OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3); 22 | 23 | OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0); 24 | 25 | #pragma mark - 26 | #define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__] 27 | 28 | #define BLYLogError(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__) 29 | #define BLYLogWarn(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelWarn, fmt, ##__VA_ARGS__) 30 | #define BLYLogInfo(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__) 31 | #define BLYLogDebug(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__) 32 | #define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__) 33 | 34 | #pragma mark - Interface 35 | @interface BuglyLog : NSObject 36 | 37 | /** 38 | * @brief 初始化日志模块 39 | * 40 | * @param level 设置默认日志级别,默认BLYLogLevelSilent 41 | * 42 | * @param printConsole 是否打印到控制台,默认NO 43 | */ 44 | + (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole; 45 | 46 | /** 47 | * @brief 打印BLYLogLevelInfo日志 48 | * 49 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 50 | */ 51 | + (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2); 52 | 53 | /** 54 | * @brief 打印日志 55 | * 56 | * @param level 日志级别 57 | * @param message 日志内容 总日志大小限制为:字符串长度30k,条数200 58 | */ 59 | + (void)level:(BuglyLogLevel) level logs:(NSString *)message; 60 | 61 | /** 62 | * @brief 打印日志 63 | * 64 | * @param level 日志级别 65 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 66 | */ 67 | + (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3); 68 | 69 | /** 70 | * @brief 打印日志 71 | * 72 | * @param level 日志级别 73 | * @param tag 日志模块分类 74 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 75 | */ 76 | + (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4); 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /EasyShowViewDemo/Bugly.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Bugly { 2 | umbrella header "Bugly.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | link framework "Foundation" 8 | link framework "Security" 9 | link framework "SystemConfiguration" 10 | link "c++" 11 | link "z" 12 | } 13 | -------------------------------------------------------------------------------- /EasyShowViewDemo/HUD_NF@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/EasyShowViewDemo/HUD_NF@2x.png -------------------------------------------------------------------------------- /EasyShowViewDemo/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 | -------------------------------------------------------------------------------- /EasyShowViewDemo/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2017/12/23. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /EasyShowViewDemo/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by Mr_Chen on 2017/12/23. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | #import "EasyShowView.h" 11 | @interface SecondViewController () 12 | 13 | @end 14 | 15 | @implementation SecondViewController 16 | - (void)dealloc{ 17 | 18 | 19 | } 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | static int index = 0 ; 24 | NSString *url = ++index%2 ? @"https://github.com/chenliangloveyou/EasyShowView" : @"https://github.com/chenliangloveyou/EasyNavigation" ; 25 | 26 | UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.bounds]; 27 | webView.delegate = self ; 28 | [webView loadRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]]; 29 | [self.view addSubview:webView]; 30 | 31 | [EasyLoadingView showLoadingText:@"加载中..."]; 32 | 33 | 34 | // Do any additional setup after loading the view. 35 | } 36 | - (void)webViewDidFinishLoad:(UIWebView *)webView 37 | { 38 | // dispatch_queue_after_S(2, ^{ 39 | [EasyLoadingView hidenLoading]; 40 | // }); 41 | } 42 | 43 | - (void)didReceiveMemoryWarning { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | /* 49 | #pragma mark - Navigation 50 | 51 | // In a storyboard-based application, you will often want to do a little preparation before navigation 52 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 53 | // Get the new view controller using [segue destinationViewController]. 54 | // Pass the selected object to the new view controller. 55 | } 56 | */ 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /EasyShowViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /EasyShowViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "EasyShowView.h" 11 | 12 | 13 | #import "SecondViewController.h" 14 | 15 | @interface ViewController () 16 | 17 | @property (nonatomic,strong)UITableView *tableView ; 18 | @property (nonatomic,strong)NSArray *dataArray ; 19 | 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | self.title = @"EasyShowView示例"; 27 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"展示1" style:UIBarButtonItemStylePlain target:self action:@selector(rightBarClick)]; 28 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"展示2" style:UIBarButtonItemStylePlain target:self action:@selector(rightBarClick)]; 29 | 30 | [self.view addSubview:self.tableView] ; 31 | } 32 | 33 | - (void)rightBarClick 34 | { 35 | [self.navigationController pushViewController:[SecondViewController new] animated:YES]; 36 | } 37 | 38 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 39 | { 40 | return self.dataArray.count ; 41 | } 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 43 | { 44 | return [self.dataArray[section] count]; 45 | } 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 47 | { 48 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath]; 49 | cell.textLabel.textColor = [UIColor blueColor]; 50 | cell.textLabel.text = self.dataArray[indexPath.section][indexPath.row]; 51 | return cell ; 52 | } 53 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 54 | { 55 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 56 | 57 | switch (indexPath.section) { 58 | case 0: [self showTextWithRow:indexPath.row] ; break ; 59 | case 1: [self showLoadingWithRow:indexPath.row]; break ; 60 | case 2: [self showEmptyWithRow:indexPath.row]; break ; 61 | case 3: [self showAlertWithRow:indexPath.row]; break ; 62 | default: break; 63 | } 64 | } 65 | 66 | //https://github.com/chenliangloveyou/EasyShowView 67 | #warning -- 欢迎到github上下载最新代码,喜欢的话,多多start~~~~ 68 | 69 | 70 | #pragma mark - showText 71 | - (void)showTextWithRow:(long)row 72 | { 73 | switch (row) { 74 | 75 | case 0: 76 | { 77 | [EasyTextView showText:@"纯文字消息" config:^EasyTextConfig *{ 78 | //(这三种方法都是一样的,根据使用习惯选择一种就行。|| 不传的参数就会使用EasyTextGlobalConfig全局配置的属性) 79 | //方法一 80 | //return [EasyTextConfig configWithSuperView:self.view superReceiveEvent:ShowTextEventUndefine animationType:TextAnimationTypeNone textStatusType:TextStatusTypeBottom]; 81 | //方法二 82 | //return [EasyTextConfig shared].setBgColor([UIColor lightGrayColor]).setShadowColor([UIColor clearColor]).setStatusType(TextStatusTypeBottom); 83 | //方法三 84 | EasyTextConfig *config = [EasyTextConfig shared]; 85 | config.bgColor = [UIColor lightGrayColor] ; 86 | config.shadowColor = [UIColor clearColor] ; 87 | config.animationType = TextAnimationTypeFade; 88 | config.statusType = TextStatusTypeBottom ; 89 | return config ; 90 | }]; 91 | }break; 92 | 93 | 94 | case 1: 95 | { 96 | [EasyTextView showSuccessText:@"显示成功消息!"]; 97 | } break; 98 | 99 | 100 | case 2: 101 | { 102 | [EasyTextView showErrorText:@"服务器错误!" config:^EasyTextConfig *{ 103 | return [EasyTextConfig shared].setStatusType(TextStatusTypeNavigation) ; 104 | }]; 105 | } break ; 106 | 107 | 108 | case 3: 109 | { 110 | [EasyTextView showInfoText:@"请完成基本信息!" config:^EasyTextConfig *{ 111 | return [EasyTextConfig shared].setShadowColor([UIColor redColor]).setBgColor([UIColor blackColor]).setTitleColor([UIColor whiteColor]).setStatusType(TextStatusTypeStatusBar); 112 | }]; 113 | }break ; 114 | 115 | 116 | case 4: 117 | { 118 | [EasyTextView showImageText:@"显示期间不接受事件!" imageName:@"HUD_NF.png" config:^EasyTextConfig *{ 119 | return [EasyTextConfig shared].setAnimationType(TextAnimationTypeNone).setShadowColor([UIColor clearColor]).setBgColor([UIColor blackColor]).setTitleColor([UIColor whiteColor]).setSuperReceiveEvent(NO); 120 | }]; 121 | }break ; 122 | } 123 | 124 | } 125 | 126 | #pragma mark - showLoading 127 | - (void)showLoadingWithRow:(long)row 128 | { 129 | switch (row) { 130 | case 0: 131 | { 132 | static int a = 0 ; 133 | NSString *s = ++a%2 ? @"" : @"加载中..."; 134 | [EasyLoadingView showLoadingText:s]; 135 | } break; 136 | 137 | 138 | case 1: 139 | { 140 | [EasyLoadingView showLoadingText:@"正在努力加载中..." config:^EasyLoadingConfig *{ 141 | static int a = 0 ; 142 | int type = ++a%2 ? LoadingShowTypeIndicatorLeft : LoadingShowTypeIndicator ; 143 | return [EasyLoadingConfig shared].setLoadingType(type); 144 | }]; 145 | }break ; 146 | 147 | 148 | case 2: 149 | { 150 | EasyLoadingView *LoadingV = [EasyLoadingView showLoadingText:@"3秒后能交互..." config:^EasyLoadingConfig *{ 151 | static int a = 0 ; 152 | int type = ++a%2 ? LoadingShowTypePlayImagesLeft : LoadingShowTypePlayImages ; 153 | return [EasyLoadingConfig shared].setLoadingType(type).setSuperReceiveEvent(NO); 154 | }]; 155 | dispatch_queue_after_S(3, ^{ 156 | [EasyLoadingView hidenLoading:LoadingV]; 157 | }); 158 | 159 | }break ; 160 | 161 | 162 | case 3: 163 | { 164 | [EasyLoadingView showLoadingText:@"正在加载中.." imageName:@"HUD_NF.png" config:^EasyLoadingConfig *{ 165 | static int a = 0 ; 166 | int type = ++a%2 ? LoadingShowTypeImageUpturnLeft : LoadingShowTypeImageUpturn ; 167 | return [EasyLoadingConfig shared].setLoadingType(type).setBgColor([UIColor blackColor]).setTintColor([UIColor whiteColor]); 168 | }]; 169 | }break ; 170 | 171 | 172 | case 4: 173 | { 174 | static int a = 0 ; 175 | NSString *s = ++a%2 ? @"大小根据图片尺寸变化" : @"" ; 176 | [EasyLoadingView showLoadingText:s imageName:@"HUD_NF.png" config:^EasyLoadingConfig *{ 177 | return [EasyLoadingConfig shared].setLoadingType(LoadingShowTypeImageAround) ; 178 | }]; 179 | }break; 180 | 181 | 182 | default: 183 | [EasyLoadingView hidenLoading]; 184 | break; 185 | } 186 | 187 | } 188 | 189 | #pragma mark - showEmpty 190 | - (void)showEmptyWithRow:(long)row 191 | { 192 | switch (row) { 193 | case 0: 194 | { 195 | [EasyEmptyView showEmptyInView:self.view part:^EasyEmptyPart *{ 196 | return [EasyEmptyPart shared].setTitle(@"网络连接已断开").setImageName(@"netError.png") ; 197 | } config:^EasyEmptyConfig *{ 198 | return [EasyEmptyConfig shared].setTitleColor([UIColor redColor]).setScrollVerticalEnable(NO); 199 | } callback:^(EasyEmptyView *view, UIButton *button, callbackType callbackType) { 200 | [EasyEmptyView hiddenEmptyInView:self.view]; 201 | }]; 202 | 203 | }break; 204 | case 1: 205 | { 206 | UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 300)]; 207 | redView.backgroundColor = [UIColor redColor]; 208 | [self.view addSubview:redView]; 209 | 210 | dispatch_queue_after_S(1, ^{ 211 | [EasyEmptyView showEmptyInView:redView part:^EasyEmptyPart *{ 212 | return [EasyEmptyPart shared].setTitle(@"你开心就好").setImageName(@"netError.png").setSubtitle(@"数据加载失败,点击重新加载!").setButtonArray(@[@"取消",@"去首页"]); 213 | } config:nil callback:nil]; 214 | }); 215 | 216 | }break ; 217 | case 2: 218 | { 219 | UIView *blueView = [[UIView alloc]initWithFrame:CGRectMake(10, 200, 300, 380)]; 220 | blueView.backgroundColor = [UIColor cyanColor]; 221 | [self.view addSubview:blueView]; 222 | 223 | dispatch_queue_after_S(1, ^{ 224 | 225 | __block EasyEmptyView *emptyV = [EasyEmptyView showEmptyInView:blueView part:^EasyEmptyPart *{ 226 | return [EasyEmptyPart shared].setImageName(@"netError.png").setTitle(@"数据加载失败,点击重新加载!"); 227 | } config:^EasyEmptyConfig *{ 228 | return [EasyEmptyConfig shared].setEasyViewEdgeInsets(UIEdgeInsetsMake(20, 30, 80, -30)) ; 229 | } callback:^(EasyEmptyView *view, UIButton *button, callbackType callbackType) { 230 | 231 | [EasyEmptyView hiddenEmptyView:emptyV]; 232 | 233 | [EasyLoadingView showLoadingText:@"正在加载中..." config:^EasyLoadingConfig *{ 234 | return [EasyLoadingConfig shared].setSuperView(blueView); 235 | }]; 236 | 237 | dispatch_queue_after_S(3, ^{ 238 | [EasyLoadingView hidenLoingInView:blueView]; 239 | [blueView removeFromSuperview]; 240 | }); 241 | }]; 242 | }); 243 | 244 | }break ; 245 | default: 246 | break; 247 | } 248 | 249 | } 250 | 251 | 252 | #pragma mark - showAlert 253 | - (void)showAlertWithRow:(long)row 254 | { 255 | switch (row) { 256 | case 0:{ 257 | static int a = 0 ; 258 | BOOL hovizonal = ++a%2 ; 259 | AlertAnimationType aniType =hovizonal ? AlertAnimationTypeFade : AlertAnimationTypeBounce ; 260 | UIColor *tintC = hovizonal ? [UIColor groupTableViewBackgroundColor] : [UIColor cyanColor] ; 261 | 262 | 263 | [EasyAlertView alertViewWithPart:^EasyAlertPart *{ 264 | return [EasyAlertPart shared].setTitle(@"请点击两下").setSubtitle(@"1,点击背景是否接受事件\n2,改变动画类型。\n3,只有两个按钮的时候,是横排还是竖排.\n4,改变背景颜色").setAlertType(AlertViewTypeAlert) ; 265 | } config:^EasyAlertConfig *{ 266 | return [EasyAlertConfig shared].settwoItemHorizontal(hovizonal).setAnimationType(aniType).setTintColor(tintC).setBgViewEvent(NO).setSubtitleTextAligment(NSTextAlignmentLeft).setEffectType(AlertBgEffectTypeAlphaCover) ; 267 | } buttonArray:^NSArray *{ 268 | return @[@"确定",@"取消"] ; 269 | } callback:^(EasyAlertView *showview , long index) { 270 | index ? [EasyTextView showSuccessText:@"点击了取消"] : [EasyTextView showText:@"点击了确定"]; 271 | }]; 272 | } break; 273 | 274 | 275 | case 1: 276 | { 277 | //第一步 创建alertview 278 | EasyAlertView *alertV = [EasyAlertView alertViewWithPart:^EasyAlertPart *{ 279 | return [EasyAlertPart shared].setTitle(@"标题").setSubtitle(@"这是副标题").setAlertType(AlertViewTypeActionSheet) ; 280 | } config:nil buttonArray:nil callback:^(EasyAlertView *showview, long index) { 281 | NSLog(@"点击了 index = %ld",index ); 282 | }]; 283 | 284 | //第二步 添加上面的按钮 285 | [alertV addAlertItemWithTitleArray:@[@"这是家的",@"zitfalsj",@"发开始放假"] callback:nil]; 286 | [alertV addAlertItem:^EasyAlertItem *{ 287 | return [EasyAlertItem itemWithTitle:@"红色粗体" type:AlertItemTypeBlodRed callback:^(EasyAlertView *showview, long index) { 288 | //因为上面已经加了一个全局的回调,所以这个地方是不会回调的 289 | NSLog(@"红色粗体 = %ld",index ); 290 | }]; 291 | }]; 292 | 293 | //第三步 显示alertview 294 | [alertV showAlertView]; 295 | 296 | } break ; 297 | case 2:{ 298 | EasyAlertView *alertView = [EasyAlertView alertViewWithTitle:@"标题" subtitle:@"负表笔" AlertViewType:AlertViewTypeSystemAlert config:nil]; 299 | [alertView addAlertItem:^EasyAlertItem *{ 300 | return [EasyAlertItem itemWithTitle:@"红色按钮_1" type:AlertItemTypeSystemDestructive callback:nil]; 301 | }]; 302 | [alertView addAlertItem:^EasyAlertItem *{ 303 | return [EasyAlertItem itemWithTitle:@"按钮 " type:AlertItemTypeSystemDefault callback:nil]; 304 | }]; 305 | [alertView addAlertItem:^EasyAlertItem *{ 306 | return [EasyAlertItem itemWithTitle:@"取消控件(一定在最下面)" type:AlertItemTypeSystemCancel callback:nil]; 307 | }]; 308 | [alertView addAlertItem:^EasyAlertItem *{ 309 | return [EasyAlertItem itemWithTitle:@"红色按钮_2" type:AlertItemTypeSystemDestructive callback:nil]; 310 | }]; 311 | [alertView addAlertItem:^EasyAlertItem *{ 312 | return [EasyAlertItem itemWithTitle:@"按钮" type:AlertItemTypeSystemDefault callback:nil]; 313 | }]; 314 | [alertView showAlertView]; 315 | }break ; 316 | case 3:{ 317 | static int a = 0 ; 318 | EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:nil subtitle:@"只有添加Cancel按钮的时候,点击背景才会销毁alertview" AlertViewType:AlertViewTypeSystemActionSheet config:nil]; 319 | if (++a%2) { 320 | [alertV addAlertItem:^EasyAlertItem *{ 321 | return [EasyAlertItem itemWithTitle:@"取消按钮" type:AlertItemTypeSystemCancel callback:nil]; 322 | }]; 323 | } 324 | [alertV addAlertItemWithTitle:@"红色按钮" type:AlertItemTypeSystemDestructive callback:nil]; 325 | [alertV addAlertItemWithTitleArray:@[@"你好",@"谢谢"] callback:nil]; 326 | 327 | [alertV showAlertView]; 328 | 329 | }break ; 330 | default: 331 | break; 332 | } 333 | } 334 | 335 | 336 | 337 | 338 | 339 | 340 | #pragma mark - getter/setter 341 | - (UITableView *)tableView 342 | { 343 | if (nil == _tableView) { 344 | _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; 345 | _tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 346 | _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; 347 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]; 348 | _tableView.dataSource = self ; 349 | _tableView.delegate = self ; 350 | } 351 | return _tableView ; 352 | } 353 | 354 | - (NSArray *)dataArray 355 | { 356 | if (nil == _dataArray) { 357 | _dataArray = @[ 358 | @[@"纯文字消息",@"成功消息",@"失败消息",@"提示消息",@"自定义图片"], 359 | @[@"转圈加载框",@"菊花加载框",@"自定义图片加载框",@"图片翻转加载框",@"图片边框转圈",@"隐藏加载框"] , 360 | @[@"空页面(不可滚动)",@"空页面(所有子控件)",@"空页面(对superview外扩内收)"], 361 | @[@"一行代码显示自定义alertView",@"ActionSheet",@"系统AlertView",@"系统ActionSheet(点2次)"] 362 | ]; 363 | } 364 | return _dataArray ; 365 | } 366 | 367 | 368 | - (void)didReceiveMemoryWarning { 369 | [super didReceiveMemoryWarning]; 370 | // Dispose of any resources that can be recreated. 371 | } 372 | 373 | 374 | @end 375 | -------------------------------------------------------------------------------- /EasyShowViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EasyShowViewDemo 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. 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 | -------------------------------------------------------------------------------- /EasyShowViewDemoUITests/EasyShowViewDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // EasyShowViewDemoUITests.m 3 | // EasyShowViewDemoUITests 4 | // 5 | // Created by nf on 2017/11/24. 6 | // Copyright © 2017年 chenliangloveyou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EasyShowViewDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation EasyShowViewDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /EasyShowViewDemoUITests/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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 chenliangloveyou 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EasyShowView 2 | 一款超级简单的展示工具,包括吐丝指示器,loding加载框,空白页提示,alertview,actionsheet的定制。可任意定制自己想要的各种样式,自定义动画,显示样式等各种操作,使各种展示更加easy。总有一个是你需要的,简单到爆。赶紧来试试吧~~~" 3 | 4 | - (支持cocoapods: pod 'EasyShowView','~>2.1') 5 | 6 | # PreView 7 | 8 | ![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/preview_all.gif "github") 9 | 10 | 11 | ![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/preview_text.gif "github") 12 | 13 | ![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/preview_loding.gif "github") 14 | 15 | ![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/preview_empty.gif "github") 16 | 17 | ![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/preview_alert.gif "github") 18 | 19 | 20 | # 使用方法 21 | #### [EasyText使用方法](https://github.com/chenliangloveyou/EasyShowView/blob/master/README/EasyText_README.md)
  22 | #### [EasyLoding使用方法](https://github.com/chenliangloveyou/EasyShowView/blob/master/README/EasyLoding_README.md)
  23 | #### [EasyEmpty使用方法](https://github.com/chenliangloveyou/EasyShowView/blob/master/README/EasyEmpty_README.md)
  24 | #### [EasyAlert使用方法](https://github.com/chenliangloveyou/EasyShowView/blob/master/README/EasyAlert_README.md)
  25 | 26 | 27 | # 联系作者 28 | - 若果在使用过程中发现问题,请[提issue](https://github.com/chenliangloveyou/EasyShowView/issues/new)。我会及时解决。 29 | - 也可以通过邮箱:chenliangloveyou@163.com 30 | 微信:![github](https://github.com/chenliangloveyou/EasyShowView/blob/master/show_preview/wechat_icon.png "github")联系我,给我提bug或建议。 31 | - 喜欢,欢迎star~~~~ 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /README/EasyAlert_README.md: -------------------------------------------------------------------------------- 1 | ## EasyAlert使用方法 2 | 3 | #### 在AppDelegate中设置全局的配置信息 -- (可省略) 4 | 5 | ``` 6 | #import "EasyTextGlobalConfig.h" 7 | 8 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 9 | { 10 | /**显示alert**/ 11 | EasyAlertGlobalConfig *alertConfig = [EasyAlertGlobalConfig shared]; 12 | alertConfig.titleColor = [UIColor blackColor]; 13 | } 14 | ``` 15 | 16 | #### 调用显示方法 --(如果单独某个显示视图不想用全局的配置信息,可以在每个显示方法中的config配置) 17 | 18 | ``` 19 | 20 | /** 21 | * 快速创建AlertView的方法 22 | * 23 | * part alertView的组成部分 标题,副标题,显示类型 24 | * config 配置信息(如果为空,就是使用EasyAlertGlobalConfig中的属性值) 25 | * buttonArray 所以需要显示的按钮 26 | * callback 点击按钮回调 27 | */ 28 | + (EasyAlertView *)alertViewWithPart:(EasyAlertPart *(^)(void))part 29 | config:(EasyAlertConfig *(^)(void))config 30 | buttonArray:(NSArray *(^)(void))buttonArray 31 | callback:(AlertCallback)callback ; 32 | 33 | ``` 34 | 35 | 36 | ``` 37 | /** 38 | * 第一步:创建一个自定义的Alert/ActionSheet 39 | */ 40 | + (instancetype)alertViewWithTitle:(NSString *)title 41 | subtitle:(NSString *)subtitle 42 | AlertViewType:(AlertViewType)alertType 43 | config:(EasyAlertConfig *(^)(void))config ; 44 | 45 | + (instancetype)alertViewWithPart:(EasyAlertPart *(^)(void))part 46 | config:(EasyAlertConfig *(^)(void))config 47 | callback:(AlertCallback)callback ; 48 | 49 | /** 50 | * 第二步:往创建的alert上面添加事件 51 | */ 52 | - (void)addAlertItemWithTitle:(NSString *)title 53 | type:(AlertItemType)type 54 | callback:(AlertCallback)callback; 55 | - (void)addAlertItem:(EasyAlertItem *(^)(void))item ; 56 | - (void)addAlertItemWithTitleArray:(NSArray *)titleArray 57 | callback:(AlertCallback)callbck ; 58 | 59 | /** 60 | * 第三步:展示alert 61 | */ 62 | - (void)showAlertView ; 63 | ``` 64 | 65 | ``` 66 | 67 | // 移除alertview 68 | - (void)removeAlertView ; 69 | 70 | ``` 71 | 72 | #### 举例说明 -- 请参考demo 73 | ``` 74 | [EasyAlertView alertViewWithPart:^EasyAlertPart *{ 75 | return [EasyAlertPart shared].setTitle(@"请点击两下").setSubtitle(@"1,点击背景是否接受事件\n2,改变动画类型。\n3,只有两个按钮的时候,是横排还是竖排.\n4,改变背景颜色").setAlertType(AlertViewTypeAlert) ; 76 | } config:^EasyAlertConfig *{ 77 | return [EasyAlertConfig shared].settwoItemHorizontal(hovizonal).setAnimationType(aniType).setTintColor(tintC).setBgViewEvent(NO).setSubtitleTextAligment(NSTextAlignmentLeft) ; 78 | } buttonArray:^NSArray *{ 79 | return @[@"确定",@"取消"] ; 80 | } callback:^(EasyAlertView *showview , long index) { 81 | index ? [EasyTextView showSuccessText:@"点击了取消"] : [EasyTextView showText:@"点击了确定"]; 82 | }]; 83 | 84 | ``` 85 | #### EasyAlertPart:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 86 | ``` 87 | 88 | @property (nonatomic,strong)NSString *title ; //标题 89 | @property (nonatomic,strong)NSString *subtitle ; //副标题 90 | @property (nonatomic,assign)AlertViewType alertType ; //alert类型 分4种 91 | ``` 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /README/EasyEmpty_README.md: -------------------------------------------------------------------------------- 1 | ## EasyEmptyView使用方法 2 | 3 |
4 | 5 | 6 | #### 在AppDelegate中设置全局的配置信息 -- (可省略) 7 | 8 | ``` 9 | #import "EasyEmptyGlobalConfig.h" 10 | 11 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 12 | { 13 | /**显示空白页面**/ 14 | EasyEmptyGlobalConfig *emptyConfig = [EasyEmptyGlobalConfig shared]; 15 | emptyConfig.bgColor = [UIColor groupTableViewBackgroundColor]; 16 | 17 | return YES; 18 | } 19 | ``` 20 | 21 |
22 | 23 | 24 | #### 调用显示方法 --(如果单独某个显示视图不想用全局的配置信息,可以在每个显示方法中的config配置) 25 | 26 | ``` 27 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 28 | item:(EasyEmptyPart *(^)(void))item ; 29 | 30 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 31 | item:(EasyEmptyPart *(^)(void))item 32 | config:(EasyEmptyConfig *(^)(void))config ; 33 | 34 | + (EasyEmptyView *)showEmptyInView:(UIView *)superview 35 | item:(EasyEmptyPart *(^)(void))item 36 | config:(EasyEmptyConfig *(^)(void))config 37 | callback:(emptyViewCallback)callback ; 38 | 39 | ``` 40 | 41 | ``` 42 | + (void)hiddenEmptyInView:(UIView *)superView ; 43 | + (void)hiddenEmptyView:(EasyEmptyView *)emptyView ; 44 | ``` 45 | 46 | 47 |
48 | 49 | 50 | #### 举例说明 51 | ``` 52 | [EasyEmptyView showEmptyInView:self.view item:^EasyEmptyPart *{ 53 | return [EasyEmptyPart shared].setTitle(@"网络连接已断开").setImageName(@"netError.png") ; 54 | } config:^EasyEmptyConfig *{ 55 | return [EasyEmptyConfig shared].setTitleColor([UIColor redColor]).setScrollVerticalEnable(NO); 56 | } callback:^(EasyEmptyView *view, UIButton *button, callbackType callbackType) { 57 | [EasyEmptyView hiddenEmptyInView:self.view]; 58 | }]; 59 | ``` 60 | 61 |
62 | 63 | 64 | #### EasyEmptyPart:empty所需要系那是的字视图,根据自己都需要选择 65 | ``` 66 | @property (nonatomic,strong)NSString *title ; //标题 67 | @property (nonatomic,strong)NSString *subtitle ; //副标题 68 | @property (nonatomic,strong)NSString *imageName ; //图片名称 69 | @property (nonatomic,strong)NSArray *buttonArray ;//下面需要的按钮 70 | ``` 71 | 72 |
73 | 74 | 75 | #### EasyEmptyConfig:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 76 | 77 | ``` 78 | @property (nonatomic,strong)UIColor *bgColor ; //背景颜色 79 | 80 | @property (nonatomic,strong)UIFont *tittleFont ; //标题字体大小 81 | @property (nonatomic,strong)UIColor *titleColor ;//标题字体颜色 82 | 83 | @property (nonatomic,strong)UIFont *subtitleFont ; //副标题字体大小 84 | @property (nonatomic,strong)UIColor *subTitleColor ;//副标题字体颜色 85 | 86 | @property (nonatomic,strong)UIFont *buttonFont ; //按钮字体大小 87 | @property (nonatomic,strong)UIColor *buttonColor ; //按钮字体亚瑟 88 | @property (nonatomic,strong)UIColor *buttonBgColor ;//按钮背景颜色 89 | 90 | @property (nonatomic,assign)UIEdgeInsets easyViewEdgeInsets ;//整个emptyview往内缩的距离(如果为负数,则会超出边界) 91 | @property (nonatomic,assign)UIEdgeInsets buttonEdgeInsets ; //按钮往内缩的边距(按钮四边边缘距离文字的距离) 92 | @property (nonatomic,assign)BOOL scrollVerticalEnable ;//是否可以上下滚动 93 | ``` 94 | 95 | 96 | -------------------------------------------------------------------------------- /README/EasyLoding_README.md: -------------------------------------------------------------------------------- 1 | ## EasyText使用方法 2 | 3 |
4 | 5 | #### 在AppDelegate中设置全局的配置信息 -- (可省略) 6 | 7 | ``` 8 | #import "EasyTextGlobalConfig.h" 9 | 10 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 11 | { 12 | /**显示加载框**/ 13 | EasyLodingGlobalConfig *lodingConfig = [EasyLodingGlobalConfig shared]; 14 | lodingConfig.lodingType = LodingAnimationTypeFade ; 15 | NSMutableArray *tempArr = [NSMutableArray arrayWithCapacity:8]; 16 | for (int i = 0; i < 9; i++) { 17 | UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"icon_hud_%d",i+1]]; 18 | [tempArr addObject:img] ; 19 | } 20 | lodingConfig.playImagesArray = tempArr ; 21 | } 22 | ``` 23 | 24 |
25 | 26 | #### 调用显示方法 --(如果单独某个显示视图不想用全局的配置信息,可以在每个显示方法中的config配置) 27 | 28 | ``` 29 | /** 30 | * 显示一个加载框(config:显示属性设置) 31 | */ 32 | + (EasyLodingView *)showLoding ; 33 | + (EasyLodingView *)showLodingText:(NSString *)text ; 34 | + (EasyLodingView *)showLodingText:(NSString *)text 35 | config:(EasyLodingConfig *(^)(void))config ; 36 | 37 | ``` 38 | 39 | 40 | ``` 41 | /** 42 | * 显示一个带图片的加载框 (config:显示属性设置) 43 | */ 44 | + (EasyLodingView *)showLodingText:(NSString *)text 45 | imageName:(NSString *)imageName ; 46 | + (EasyLodingView *)showLodingText:(NSString *)text 47 | imageName:(NSString *)imageName 48 | config:(EasyLodingConfig *(^)(void))config ; 49 | 50 | ``` 51 | 52 | ``` 53 | /** 54 | * 移除一个加载框 55 | * superview:加载框所在的父视图。(如果show没指定父视图。那么隐藏也不用) 56 | */ 57 | + (void)hidenLoding ; 58 | + (void)hidenLoingInView:(UIView *)superView ; 59 | + (void)hidenLoding:(EasyLodingView *)lodingView ; 60 | 61 | 62 | ``` 63 | 64 |
65 | 66 | #### 举例说明 67 | 68 | __显示lodingview__ 69 | ``` 70 | //没有加配置信息,所以显示的样式都会使用appdelegate中EasyTextGlobalConfig设置的。 71 | [EasyLodingView showLodingText:@"加载中..."]; 72 | 73 | //增加config配置信息。那么statusType属性会使用刚设置的。其他属性会继续使用EasyTextGlobalConfig设置的。 74 | [EasyLodingView showLodingText:@"正在努力加载中..." config:^EasyLodingConfig *{ 75 | return [EasyLodingConfig shared].setLodingType(LodingShowTypeIndicatorLeft); 76 | }]; 77 | 78 | ``` 79 | __隐藏lodingview__ 80 | ``` 81 | //会移除window或者是topviewcontroller上所有的lidngview 82 | [EasyLodingView hidenLoding]; 83 | 84 | //移除特定的lodingview 85 | [EasyLodingView hidenLoding:lodingV]; 86 | 87 | ``` 88 |
89 | 90 | #### EasyLodingConfig:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 91 | ``` 92 | 93 | //方法一 94 | return [EasyLodingConfig configInView:self.view showType:LodingShowTypePlayImagesLeft]; 95 | 96 | //方法二 97 | return [EasyLodingConfig shared].setLodingType(LodingShowTypePlayImagesLeft).setSuperReceiveEvent(NO); 98 | 99 | //方法三 100 | EasyLodingConfig *config = [EasyLodingConfig shared]; 101 | config.lodingType = LodingShowTypePlayImagesLeft ; 102 | config.superView = self.view ; 103 | return config ; 104 | ``` 105 | 106 | 107 | -------------------------------------------------------------------------------- /README/EasyText_README.md: -------------------------------------------------------------------------------- 1 | ## EasyText使用方法 2 | 3 |
4 | 5 | #### 在AppDelegate中设置全局的配置信息 -- (可省略) 6 | 7 | ``` 8 | #import "EasyTextGlobalConfig.h" 9 | 10 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 11 | { 12 | /**显示文字**/ 13 | EasyTextGlobalConfig *config = [EasyTextGlobalConfig shared]; 14 | config.bgColor = [UIColor whiteColor]; 15 | config.titleColor = [UIColor blackColor]; 16 | } 17 | ``` 18 | 19 |
20 | 21 | #### 调用显示方法 --(如果单独某个显示视图不想用全局的配置信息,可以在每个显示方法中的config配置) 22 | 23 | ``` 24 | /** 25 | * 显示一个纯文字消息 (config:显示属性设置) 26 | */ 27 | + (void)showText:(NSString *)text ; 28 | + (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 29 | ``` 30 | 31 | 32 | ``` 33 | /** 34 | * 显示一个成功消息(config:显示属性设置) 35 | */ 36 | + (void)showSuccessText:(NSString *)text ; 37 | + (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 38 | 39 | ``` 40 | 41 | ``` 42 | /** 43 | * 显示一个错误消息(config:显示属性设置) 44 | */ 45 | + (void)showErrorText:(NSString *)text ; 46 | + (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 47 | 48 | ``` 49 | 50 | ``` 51 | /** 52 | * 显示一个提示消息(config:显示属性设置) 53 | */ 54 | + (void)showInfoText:(NSString *)text ; 55 | + (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; 56 | 57 | ``` 58 | 59 | ``` 60 | /** 61 | * 显示一个自定义图片消息(config:显示属性设置) 62 | */ 63 | + (void)showImageText:(NSString *)text imageName:(NSString *)imageName ; 64 | + (void)showImageText:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *(^)(void))config ; 65 | 66 | ``` 67 | 68 |
69 | 70 | #### 举例说明 71 | ``` 72 | //没有加配置信息,所以显示的样式都会使用appdelegate中EasyTextGlobalConfig设置的。 73 | [EasyTextView showSuccessText:@"显示成功消息!"]; 74 | 75 | //增加config配置信息。那么statusType属性会使用刚设置的。其他属性会继续使用EasyTextGlobalConfig设置的。 76 | [EasyTextView showErrorText:@"服务器错误!" config:^EasyTextConfig *{ 77 | return [EasyTextConfig shared].setStatusType(TextStatusTypeNavigation) ; 78 | }]; 79 | 80 | ``` 81 | 82 |
83 | 84 | #### EasyTextConfig说明:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 85 | ``` 86 | //方法一 87 | return [EasyTextConfig configWithSuperView:self.view superReceiveEvent:ShowTextEventUndefine animationType:TextAnimationTypeNone textStatusType:TextStatusTypeBottom]; 88 | //方法二 89 | return [EasyTextConfig shared].setBgColor([UIColor lightGrayColor]).setShadowColor([UIColor clearColor]).setStatusType(TextStatusTypeBottom); 90 | //方法三 91 | EasyTextConfig *config = [EasyTextConfig shared]; 92 | config.bgColor = [UIColor lightGrayColor] ; 93 | config.shadowColor = [UIColor clearColor] ; 94 | config.animationType = TextAnimationTypeFade; 95 | config.statusType = TextStatusTypeBottom ; 96 | return config ; 97 | ``` 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /note.txt: -------------------------------------------------------------------------------- 1 | 提示: 2 | -------------------------------------------------------------------------------- /show_preview/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/.DS_Store -------------------------------------------------------------------------------- /show_preview/preview_alert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/preview_alert.gif -------------------------------------------------------------------------------- /show_preview/preview_all.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/preview_all.gif -------------------------------------------------------------------------------- /show_preview/preview_empty.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/preview_empty.gif -------------------------------------------------------------------------------- /show_preview/preview_loding.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/preview_loding.gif -------------------------------------------------------------------------------- /show_preview/preview_text.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/preview_text.gif -------------------------------------------------------------------------------- /show_preview/wechat_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenliangloveyou/EasyShowView/254845d889067dd0a176c4e2ebbd8d71a1282b52/show_preview/wechat_icon.png --------------------------------------------------------------------------------