|
1 |
| -## EasyText使用方法 |
| 1 | +## EasyEmptyView使用方法 |
| 2 | + |
| 3 | +<br> |
| 4 | + |
2 | 5 |
|
3 | 6 | #### 在AppDelegate中设置全局的配置信息 -- (可省略)
|
4 | 7 |
|
5 | 8 | ```
|
6 |
| -#import "EasyTextGlobalConfig.h" |
| 9 | +#import "EasyEmptyGlobalConfig.h" |
7 | 10 |
|
8 | 11 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
9 | 12 | {
|
10 |
| - /**显示文字**/ |
11 |
| - EasyTextGlobalConfig *config = [EasyTextGlobalConfig shared]; |
12 |
| - config.bgColor = [UIColor whiteColor]; |
13 |
| - config.titleColor = [UIColor blackColor]; |
| 13 | + /**显示空白页面**/ |
| 14 | + EasyEmptyGlobalConfig *emptyConfig = [EasyEmptyGlobalConfig shared]; |
| 15 | + emptyConfig.bgColor = [UIColor groupTableViewBackgroundColor]; |
| 16 | + |
| 17 | + return YES; |
14 | 18 | }
|
15 | 19 | ```
|
16 | 20 |
|
| 21 | +<br> |
| 22 | + |
| 23 | + |
17 | 24 | #### 调用显示方法 --(如果单独某个显示视图不想用全局的配置信息,可以在每个显示方法中的config配置)
|
18 | 25 |
|
19 | 26 | ```
|
20 |
| -/** |
21 |
| - * 显示一个纯文字消息 (config:显示属性设置) |
22 |
| - */ |
23 |
| -+ (void)showText:(NSString *)text ; |
24 |
| -+ (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
| 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 | + |
25 | 39 | ```
|
26 | 40 |
|
27 |
| - |
28 | 41 | ```
|
29 |
| -/** |
30 |
| - * 显示一个成功消息(config:显示属性设置) |
31 |
| - */ |
32 |
| -+ (void)showSuccessText:(NSString *)text ; |
33 |
| -+ (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
34 |
| -
|
| 42 | ++ (void)hiddenEmptyInView:(UIView *)superView ; |
| 43 | ++ (void)hiddenEmptyView:(EasyEmptyView *)emptyView ; |
35 | 44 | ```
|
36 | 45 |
|
37 |
| -``` |
38 |
| -/** |
39 |
| - * 显示一个错误消息(config:显示属性设置) |
40 |
| - */ |
41 |
| -+ (void)showErrorText:(NSString *)text ; |
42 |
| -+ (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
43 | 46 |
|
44 |
| -``` |
| 47 | +<br> |
45 | 48 |
|
46 |
| -``` |
47 |
| -/** |
48 |
| - * 显示一个提示消息(config:显示属性设置) |
49 |
| - */ |
50 |
| -+ (void)showInfoText:(NSString *)text ; |
51 |
| -+ (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
52 | 49 |
|
| 50 | +#### 举例说明 |
53 | 51 | ```
|
54 |
| - |
| 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 | + }]; |
55 | 59 | ```
|
56 |
| -/** |
57 |
| - * 显示一个自定义图片消息(config:显示属性设置) |
58 |
| - */ |
59 |
| -+ (void)showImageText:(NSString *)text imageName:(NSString *)imageName ; |
60 |
| -+ (void)showImageText:(NSString *)text imageName:(NSString *)imageName config:(EasyTextConfig *(^)(void))config ; |
61 | 60 |
|
62 |
| -``` |
| 61 | +<br> |
63 | 62 |
|
64 |
| -#### 举例说明 |
65 |
| -``` |
66 |
| -//没有加配置信息,所以显示的样式都会使用appdelegate中EasyTextGlobalConfig设置的。 |
67 |
| -[EasyTextView showSuccessText:@"显示成功消息!"]; |
68 |
| -
|
69 |
| -//增加config配置信息。那么statusType属性会使用刚设置的。其他属性会继续使用EasyTextGlobalConfig设置的。 |
70 |
| -[EasyTextView showErrorText:@"服务器错误!" config:^EasyTextConfig *{ |
71 |
| - return [EasyTextConfig shared].setStatusType(TextStatusTypeNavigation) ; |
72 |
| -}]; |
73 | 63 |
|
| 64 | + #### EasyEmptyPart:empty所需要系那是的字视图,根据自己都需要选择 |
74 | 65 | ```
|
75 |
| - #### EasyTextConfig说明:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 |
| 66 | + @property (nonatomic,strong)NSString *title ; //标题 |
| 67 | +@property (nonatomic,strong)NSString *subtitle ; //副标题 |
| 68 | +@property (nonatomic,strong)NSString *imageName ; //图片名称 |
| 69 | +@property (nonatomic,strong)NSArray<NSString *> *buttonArray ;//下面需要的按钮 |
76 | 70 | ```
|
77 |
| - //方法一 |
78 |
| - return [EasyTextConfig configWithSuperView:self.view superReceiveEvent:ShowTextEventUndefine animationType:TextAnimationTypeNone textStatusType:TextStatusTypeBottom]; |
79 |
| - //方法二 |
80 |
| - return [EasyTextConfig shared].setBgColor([UIColor lightGrayColor]).setShadowColor([UIColor clearColor]).setStatusType(TextStatusTypeBottom); |
81 |
| - //方法三 |
82 |
| - EasyTextConfig *config = [EasyTextConfig shared]; |
83 |
| - config.bgColor = [UIColor lightGrayColor] ; |
84 |
| - config.shadowColor = [UIColor clearColor] ; |
85 |
| - config.animationType = TextAnimationTypeFade; |
86 |
| - config.statusType = TextStatusTypeBottom ; |
87 |
| - return config ; |
| 71 | + |
| 72 | +<br> |
| 73 | + |
| 74 | + |
| 75 | + #### EasyEmptyConfig:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 |
| 76 | + |
88 | 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 ;//副标题字体颜色 |
89 | 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 | +``` |
90 | 94 |
|
91 | 95 |
|
0 commit comments