|
1 | 1 | ## EasyText使用方法
|
2 | 2 |
|
| 3 | +<br> |
| 4 | + |
3 | 5 | #### 在AppDelegate中设置全局的配置信息 -- (可省略)
|
4 | 6 |
|
5 | 7 | ```
|
6 | 8 | #import "EasyTextGlobalConfig.h"
|
7 | 9 |
|
8 | 10 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
9 | 11 | {
|
10 |
| - /**显示文字**/ |
11 |
| - EasyTextGlobalConfig *config = [EasyTextGlobalConfig shared]; |
12 |
| - config.bgColor = [UIColor whiteColor]; |
13 |
| - config.titleColor = [UIColor blackColor]; |
| 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 ; |
14 | 21 | }
|
15 | 22 | ```
|
16 | 23 |
|
| 24 | +<br> |
| 25 | + |
17 | 26 | #### 调用显示方法 --(如果单独某个显示视图不想用全局的配置信息,可以在每个显示方法中的config配置)
|
18 | 27 |
|
19 | 28 | ```
|
20 | 29 | /**
|
21 |
| - * 显示一个纯文字消息 (config:显示属性设置) |
| 30 | + * 显示一个加载框(config:显示属性设置) |
22 | 31 | */
|
23 |
| -+ (void)showText:(NSString *)text ; |
24 |
| -+ (void)showText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
25 |
| -``` |
26 |
| - |
| 32 | ++ (EasyLodingView *)showLoding ; |
| 33 | ++ (EasyLodingView *)showLodingText:(NSString *)text ; |
| 34 | ++ (EasyLodingView *)showLodingText:(NSString *)text |
| 35 | + config:(EasyLodingConfig *(^)(void))config ; |
27 | 36 |
|
28 | 37 | ```
|
29 |
| -/** |
30 |
| - * 显示一个成功消息(config:显示属性设置) |
31 |
| - */ |
32 |
| -+ (void)showSuccessText:(NSString *)text ; |
33 |
| -+ (void)showSuccessText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
34 | 38 |
|
35 |
| -``` |
36 | 39 |
|
37 | 40 | ```
|
38 | 41 | /**
|
39 |
| - * 显示一个错误消息(config:显示属性设置) |
| 42 | + * 显示一个带图片的加载框 (config:显示属性设置) |
40 | 43 | */
|
41 |
| -+ (void)showErrorText:(NSString *)text ; |
42 |
| -+ (void)showErrorText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
| 44 | ++ (EasyLodingView *)showLodingText:(NSString *)text |
| 45 | + imageName:(NSString *)imageName ; |
| 46 | ++ (EasyLodingView *)showLodingText:(NSString *)text |
| 47 | + imageName:(NSString *)imageName |
| 48 | + config:(EasyLodingConfig *(^)(void))config ; |
43 | 49 |
|
44 | 50 | ```
|
45 | 51 |
|
46 | 52 | ```
|
47 | 53 | /**
|
48 |
| - * 显示一个提示消息(config:显示属性设置) |
| 54 | + * 移除一个加载框 |
| 55 | + * superview:加载框所在的父视图。(如果show没指定父视图。那么隐藏也不用) |
49 | 56 | */
|
50 |
| -+ (void)showInfoText:(NSString *)text ; |
51 |
| -+ (void)showInfoText:(NSString *)text config:(EasyTextConfig *(^)(void))config ; |
| 57 | ++ (void)hidenLoding ; |
| 58 | ++ (void)hidenLoingInView:(UIView *)superView ; |
| 59 | ++ (void)hidenLoding:(EasyLodingView *)lodingView ; |
52 | 60 |
|
53 |
| -``` |
54 | 61 |
|
55 | 62 | ```
|
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 | 63 |
|
62 |
| -``` |
| 64 | +<br> |
63 | 65 |
|
64 | 66 | #### 举例说明
|
| 67 | + |
| 68 | +__显示lodingview__ |
65 | 69 | ```
|
66 | 70 | //没有加配置信息,所以显示的样式都会使用appdelegate中EasyTextGlobalConfig设置的。
|
67 |
| -[EasyTextView showSuccessText:@"显示成功消息!"]; |
| 71 | +[EasyLodingView showLodingText:@"加载中..."]; |
68 | 72 |
|
69 | 73 | //增加config配置信息。那么statusType属性会使用刚设置的。其他属性会继续使用EasyTextGlobalConfig设置的。
|
70 |
| -[EasyTextView showErrorText:@"服务器错误!" config:^EasyTextConfig *{ |
71 |
| - return [EasyTextConfig shared].setStatusType(TextStatusTypeNavigation) ; |
72 |
| -}]; |
| 74 | + [EasyLodingView showLodingText:@"正在努力加载中..." config:^EasyLodingConfig *{ |
| 75 | + return [EasyLodingConfig shared].setLodingType(LodingShowTypeIndicatorLeft); |
| 76 | + }]; |
73 | 77 |
|
74 | 78 | ```
|
75 |
| - #### EasyTextConfig说明:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 |
| 79 | +__隐藏lodingview__ |
| 80 | +``` |
| 81 | + //会移除window或者是topviewcontroller上所有的lidngview |
| 82 | + [EasyLodingView hidenLoding]; |
| 83 | +
|
| 84 | + //移除特定的lodingview |
| 85 | + [EasyLodingView hidenLoding:lodingV]; |
| 86 | +
|
76 | 87 | ```
|
| 88 | +<br> |
| 89 | + |
| 90 | + #### EasyLodingConfig:它是显示属性的配置信息。提供了三种方法。这三种方法都是一样的,根据使用习惯选择一种就行。 |
| 91 | +``` |
| 92 | + |
77 | 93 | //方法一
|
78 |
| - return [EasyTextConfig configWithSuperView:self.view superReceiveEvent:ShowTextEventUndefine animationType:TextAnimationTypeNone textStatusType:TextStatusTypeBottom]; |
| 94 | + return [EasyLodingConfig configInView:self.view showType:LodingShowTypePlayImagesLeft]; |
| 95 | + |
79 | 96 | //方法二
|
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 ; |
| 97 | + return [EasyLodingConfig shared].setLodingType(LodingShowTypePlayImagesLeft).setSuperReceiveEvent(NO); |
| 98 | +
|
| 99 | + //方法三 |
| 100 | + EasyLodingConfig *config = [EasyLodingConfig shared]; |
| 101 | + config.lodingType = LodingShowTypePlayImagesLeft ; |
| 102 | + config.superView = self.view ; |
87 | 103 | return config ;
|
88 | 104 | ```
|
89 | 105 |
|
90 | 106 |
|
91 |
| - |
|
0 commit comments