Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit 4f64727

Browse files
committed
1. 添加点击与滑动手势,现在点击与向上滑动横幅可以令横幅消失啦。
2. 在.h文件中暴露3个宏定义,方便用户使用。 3. 暴露单例方法,提供1个用于设置样式的对象方法。 4. 暴露弹出提示窗与隐藏提示窗的方法。
1 parent 9ad4044 commit 4f64727

File tree

6 files changed

+250
-67
lines changed

6 files changed

+250
-67
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ fastlane/test_output
6363
iOSInjectionProject/
6464
RKOTextViewManager/.Archive/README.md
6565
.Archive/README.md
66+
RKOTopAlertManager/.Archive/README.md

README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
### RKOTextView
4343

4444
<p align="left">
45-
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.1-brightgreen.svg"></a>
45+
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.3-brightgreen.svg"></a>
4646
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
4747
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
4848
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
@@ -78,7 +78,7 @@
7878
### RKOTopAlert
7979
8080
<p align="left">
81-
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.0-brightgreen.svg"></a>
81+
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.1-brightgreen.svg"></a>
8282
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
8383
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
8484
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
@@ -89,7 +89,7 @@
8989
#### 集成:
9090
9191
```shell
92-
pod 'RKOTopAlert', '~> 1.0.0'
92+
pod 'RKOTopAlert', '~> 1.0.1'
9393
```
9494

9595
#### 使用:
@@ -98,6 +98,16 @@
9898
[RKOTopAlert popAlertViewWithText:@"提醒文字" textColor:[UIColor redColor] ackgroundColor:[UIColor blackColor];
9999
```
100100
101+
或者:
102+
103+
```objc
104+
// 创建单例并设置样式。
105+
RKOTopAlert *topAlert = [[self sharedManager] alertViewWithText:@"提醒文字" textColor:[UIColor whiteColor] ackgroundColor:[UIColor redColor]];
106+
107+
// 出现
108+
[topAlert alertAppearWithDuration:0.3f];
109+
```
110+
101111
---------------------------------------------------------------------
102112

103113
## RKOTools

RKOTopAlertManager/README.md

+66-18
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,54 @@
11
# RKOTopAlert
22

3-
自定义一个顶端的`Alert`提示窗。
4-
53
<p align="center">
6-
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.0-brightgreen.svg"></a>
4+
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.1-brightgreen.svg"></a>
75
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
86
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
97
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
108
</p>
119

1210
## 简介
1311

14-
自定义一个顶端的`Alert`提示窗。弹出时从顶端向下移动。
15-
12+
自定义一个顶端的`Alert`提示窗。弹出时从顶端向下移动。(**在iPhone X下可用**
1613

1714
可以设置**提示文字****文字颜色****背景颜色**
1815

1916
**高度**`Status` + `NavigationBar`的高度。(不论您的`ViewController`是否添加到`NavigationController`中)
2017

21-
注意:该控件有以下几点**未进行测试**
22-
1. 编写时考虑到了自定义`NavigationBar`,但因为时间原因未进行测试。
23-
2. 自定义`NavigationBar`,但自定义`NavigationBar`隐藏时的效果。
24-
3. 原生`NavigationBar`隐藏时的情况。
25-
3. 隐藏`Status`时的效果。
18+
- 注意:该控件有以下几点**未进行测试**
19+
1. 编写时考虑到了自定义`NavigationBar`,但因为时间原因未进行测试。
20+
2. 自定义`NavigationBar`,但自定义`NavigationBar`隐藏时的效果。
21+
3. 原生`NavigationBar`隐藏时的情况。
22+
4. 隐藏`Status`时的效果。
2623

2724
如果在您的项目中用到了以上几点未测试的功能,请将您的结果告诉我,帮助我完善该控件。
2825

26+
## 已知问题
27+
28+
该控件还**未做自动布局**,故在横屏下会出现问题。
29+
2930
## 集成
3031

3132
```shell
32-
pod 'RKOTopAlert', '~> 1.0.0'
33+
pod 'RKOTopAlert', '~> 1.0.1'
3334
```
3435

3536
## 使用
3637

37-
在需要弹出该提示窗的地方调用下面的方法
38+
在需要弹出该提示窗的地方调用下面的方法:
39+
40+
```objc
41+
[RKOTopAlert popAlertViewWithText:@"提醒文字" textColor:[UIColor whiteColor] ackgroundColor:[UIColor redColor];
42+
```
43+
44+
如果您的`App`需要统一多个提示窗的样式,那么推荐您使用下面的方法:
3845
3946
```objc
40-
[RKOTopAlert popAlertViewWithText:@"提醒文字" textColor:[UIColor redColor] ackgroundColor:[UIColor blackColor];
47+
// 创建单例并设置样式。
48+
RKOTopAlert *topAlert = [[self sharedManager] alertViewWithText:@"提醒文字" textColor:[UIColor whiteColor] ackgroundColor:[UIColor redColor]];
49+
50+
// 出现
51+
[topAlert alertAppearWithDuration:0.3f];
4152
```
4253

4354
## 接口
@@ -46,16 +57,53 @@
4657

4758
```objc
4859
/**
49-
设置提示窗的样式
60+
* 设置提示窗的样式,并弹出提示窗。(其对象参数均不可为nil。)
5061
51-
@param text 提示窗显示文字,不能为nil。为空则设置无效
52-
@param textColor 文字颜色
53-
@param backgroundColor 提示窗背景颜色
54-
@param duration 横幅持续显示的时间
62+
* @param text 提示窗显示文字。
63+
* @param textColor 文字颜色
64+
* @param backgroundColor 提示窗背景颜色
65+
* @param duration 横幅持续显示的时间
5566
*/
5667
+ (void)popAlertViewWithText:(NSString *)text
5768
textColor:(UIColor *)textColor
5869
ackgroundColor:(UIColor *)backgroundColor
5970
duration:(CGFloat)duration;
6071
```
6172

73+
此外,考虑到您可以需要统一的设置多个弹窗,我们提供如下的方法进行设置:
74+
75+
```objc
76+
/**
77+
* 单例方法,创建对象。
78+
79+
* @return 提示窗Alert。
80+
*/
81+
+ (RKOTopAlert *)sharedManager;
82+
83+
/**
84+
* 设置样式。(其对象参数均不可为nil。)
85+
86+
* @param text 提示窗显示文字。
87+
* @param textColor 文字颜色。
88+
* @param backgroundColor 提示窗背景颜色。
89+
*/
90+
- (void)alertViewWithText:(NSString *)text
91+
textColor:(UIColor *)textColor
92+
ackgroundColor:(UIColor *)backgroundColor;
93+
```
94+
95+
此外,我们分别提供了弹窗弹窗的**弹出**方法与**消失**方法,方便您在他处动态地控制弹窗的弹出与消失:
96+
97+
```objc
98+
/**
99+
* 弹出提示窗的方法。
100+
101+
* @param duration 横幅持续显示的时间。
102+
*/
103+
- (void)alertAppearWithDuration:(CGFloat)duration;
104+
105+
/**
106+
* 令顶部提示窗消失的方法。
107+
*/
108+
- (void)alertDisappear;
109+
```

RKOTopAlertManager/RKOTopAlert.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Pod::Spec.new do |s|
1010

1111
s.name = "RKOTopAlert"
12-
s.version = "1.0.0"
12+
s.version = "1.0.1"
1313
s.summary = "Appears at the top of the notification view"
1414
s.description = <<-DESC
1515
Appears at the top of the notification view
@@ -23,7 +23,7 @@ Pod::Spec.new do |s|
2323

2424
s.ios.deployment_target = "7.0"
2525

26-
s.source = { :git => "https://github.com/rakuyoMo/RKOControls.git", :tag => "1.0.0" } # #{s.version}
26+
s.source = { :git => "https://github.com/rakuyoMo/RKOControls.git", :tag => "1.0.4" } # #{s.version}
2727

2828
s.requires_arc = true
2929

RKOTopAlertManager/RKOTopAlert/RKOTopAlert/RKOTopAlert/RKOTopAlert.h

+50-6
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,63 @@
88

99
#import <UIKit/UIKit.h>
1010

11+
// 弹出动画的持续时间。
12+
#define ALERT_APPEAR_ANIMATE_DURATION 0.4f
13+
// 消失动画的持续时间。
14+
#define ALERT_DISAPPEAR_ANIMATE_DURATION 0.3f
15+
// 提示文字的字体大小。
16+
#define FONTSIZE 20
17+
18+
NS_ASSUME_NONNULL_BEGIN
19+
1120
@interface RKOTopAlert : UIView
1221

22+
#pragma mark - 分别设置每个弹窗样式。
1323
/**
14-
设置提示窗的样式
15-
16-
@param text 提示窗显示文字,不能为nil。为空则设置无效
17-
@param textColor 文字颜色
18-
@param backgroundColor 提示窗背景颜色
19-
@param duration 横幅持续显示的时间
24+
* 设置提示窗的样式,并弹出提示窗。(其对象参数均不可为nil。)
25+
26+
* @param text 提示窗显示文字。
27+
* @param textColor 文字颜色
28+
* @param backgroundColor 提示窗背景颜色
29+
* @param duration 横幅持续显示的时间
2030
*/
2131
+ (void)popAlertViewWithText:(NSString *)text
2232
textColor:(UIColor *)textColor
2333
ackgroundColor:(UIColor *)backgroundColor
2434
duration:(CGFloat)duration;
2535

36+
#pragma mark - 统一设置App所有弹窗样式
37+
/**
38+
* 单例方法,创建对象。
39+
40+
* @return 提示窗Alert。
41+
*/
42+
+ (RKOTopAlert *)sharedManager;
43+
44+
/**
45+
设置样式。(其对象参数均不可为nil。)
46+
47+
@param text 提示窗显示文字。
48+
@param textColor 文字颜色。
49+
@param backgroundColor 提示窗背景颜色。
50+
*/
51+
- (void)alertViewWithText:(NSString *)text
52+
textColor:(UIColor *)textColor
53+
ackgroundColor:(UIColor *)backgroundColor;
54+
55+
/**
56+
* 弹出提示窗的方法。
57+
58+
* @param duration 横幅持续显示的时间。
59+
*/
60+
- (void)alertAppearWithDuration:(CGFloat)duration;
61+
62+
/**
63+
* 令顶部提示窗消失的方法。
64+
*/
65+
- (void)alertDisappear;
66+
2667
@end
68+
69+
NS_ASSUME_NONNULL_END
70+

0 commit comments

Comments
 (0)