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

Commit

Permalink
1. 集成了 Masonry,支持自动布局。
Browse files Browse the repository at this point in the history
2. 接口可以设置字体了。
3. 其他优化。
  • Loading branch information
rakuyoMo committed Mar 7, 2018
1 parent a54c44c commit 114f257
Show file tree
Hide file tree
Showing 11 changed files with 336 additions and 148 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ iOSInjectionProject/
RKOTextViewManager/.Archive/README.md
.Archive/README.md
RKOTopAlertManager/.Archive/README.md
RKOTopAlertManager/RKOTopAlert/Pods
*.xcworkspacedata
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ textViewWithCode.needBorder = YES;
### RKOTopAlert
<p align="left">
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.5-brightgreen.svg"></a>
<a href=""><img src="https://img.shields.io/badge/pod-v1.1.0-brightgreen.svg"></a>
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
<a href=""><img src="https://img.shields.io/badge/platform-iOS%209.0%2B-ff69b5152950834.svg"></a>
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
</p>
Expand All @@ -93,14 +93,17 @@ textViewWithCode.needBorder = YES;
#### 集成:
```shell
pod 'RKOTopAlert', '~> 1.0.5'
pod 'RKOTopAlert', '~> 1.1.0'
```

#### 使用:

```objc
RKOTopAlert *topAlert = [RKOTopAlert alertViewWithText:@"提示文字" textColor:[UIColor whiteColor] backgroundColor:[UIColor redColor] iconImageName:nil];

RKOTopAlert *topAlert = [RKOTopAlert alertViewWithText:@"单独设置提示文字"
textColor:[UIColor whiteColor]
backgroundColor:[UIColor redColor]
iconImageName:nil
font:[UIFont systemFontOfSize:15.0f]];
[topAlert alertAppearWithDuration:2.0];
```
Expand Down
29 changes: 20 additions & 9 deletions RKOTopAlertManager/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# RKOTopAlert

<p align="center">
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.5-brightgreen.svg"></a>
<a href=""><img src="https://img.shields.io/badge/pod-v1.1.0-brightgreen.svg"></a>
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
<a href=""><img src="https://img.shields.io/badge/platform-iOS%209.0%2B-ff69b5152950834.svg"></a>
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
</p>

## 简介

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

随仓库配套了一个简单的 **演示Demo**,方便大家使用参考。
集成了 `Masonry` 来做自动布局,支持横屏。

随仓库配套了一个简单的 **演示Demo**,方便大家使用参考,使用时请先更新 `pod`

可以设置**提示文字****文字颜色****背景颜色****提醒图标**

Expand All @@ -27,21 +29,24 @@

## 已知问题

该控件还**未做自动布局**,故在横屏下会出现问题。


## 集成

```shell
pod 'RKOTopAlert', '~> 1.0.5'
pod 'RKOTopAlert', '~> 1.1.0'
```

## 使用

使用下面的方法创建一个`Alert`视图,对`Alert`视图调用 `alertAppearWithDuration` 并设置时候,即可弹出 `Alert`视图。

```objc
RKOTopAlert *topAlert = [RKOTopAlert alertViewWithText:@"提示文字" textColor:[UIColor whiteColor] backgroundColor:[UIColor redColor] iconImageName:nil];

RKOTopAlert *topAlert = [RKOTopAlert alertViewWithText:@"单独设置提示文字"
textColor:[UIColor whiteColor]
backgroundColor:[UIColor redColor]
iconImageName:nil
font:[UIFont systemFontOfSize:15.0f]];
[topAlert alertAppearWithDuration:2.0];
```
Expand All @@ -53,7 +58,11 @@ RKOTopAlert *topAlert = [RKOTopAlert alertViewWithText:@"提示文字" textColor
// 懒加载属性,创建对象并设置样式。
- (RKOTopAlert *)topAlert {
return [RKOTopAlert alertViewWithText:@"在AppDelegate中总体设置" textColor:[UIColor blackColor] backgroundColor:[UIColor orangeColor] iconImageName:nil];
return [RKOTopAlert alertViewWithText:@"在AppDelegate中总体设置"
textColor:[UIColor blackColor]
backgroundColor:[UIColor orangeColor]
iconImageName:nil
font:[UIFont systemFontOfSize:15.0f]];
}
// 在按钮方法或其它方法中,获取属性调用弹出方法。
Expand All @@ -74,12 +83,14 @@ RKOTopAlert *topAlert = [RKOTopAlert alertViewWithText:@"提示文字" textColor
* @param textColor 文字颜色。
* @param backgroundColor 提示窗背景颜色。
* @param iconImageName 左侧提示图标的图片名。
* @param font 文字字体
* @return 调用对象本身
*/
+ (instancetype)alertViewWithText:(NSString *)text
textColor:(UIColor *)textColor
backgroundColor:(UIColor *)backgroundColor
iconImageName:(nullable NSString *)iconImageName;
iconImageName:(nullable NSString *)iconImageName
font:(UIFont *)font;
```

此外,我们分别提供了弹窗弹窗的**弹出**方法与**消失**方法,方便您动态地控制弹窗的弹出与消失:
Expand Down
8 changes: 5 additions & 3 deletions RKOTopAlertManager/RKOTopAlert.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = "RKOTopAlert"
s.version = "1.0.5"
s.version = "1.1.0"
s.summary = "Appears at the top of the notification view"
s.description = <<-DESC
Appears at the top of the notification view
Expand All @@ -21,14 +21,16 @@ Pod::Spec.new do |s|

s.author = { "Rakuyo" => "rakuyo.mo@gmail.com" }

s.ios.deployment_target = "7.0"
s.ios.deployment_target = "9.0"

s.source = { :git => "https://github.com/rakuyoMo/RKOControls.git", :tag => "1.0.10" } # #{s.version}
s.source = { :git => "https://github.com/rakuyoMo/RKOControls.git", :tag => "1.3.11" } # #{s.version}

s.requires_arc = true

s.source_files = "RKOTopAlertManager/RKOTopAlert/RKOTopAlert/RKOTopAlert/*.{h,m}"

s.resources = "RKOTopAlertManager/RKOTopAlert/RKOTopAlert/RKOTopAlert/*.{png,xib,nib,bundle}"

s.dependency "Masonry"

end
12 changes: 12 additions & 0 deletions RKOTopAlertManager/RKOTopAlert/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'RKOTopAlert' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!

# Pods for RKOTopAlert

pod 'Masonry'

end
12 changes: 12 additions & 0 deletions RKOTopAlertManager/RKOTopAlert/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PODS:
- Masonry (1.1.0)

DEPENDENCIES:
- Masonry

SPEC CHECKSUMS:
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201

PODFILE CHECKSUM: 2089bb5cf41476709496c493a96b09abd7f4987b

COCOAPODS: 1.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0A209D08867A750CF3EEF438 /* libPods-RKOTopAlert.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63CC9D40FCCB57CBBFFD5E74 /* libPods-RKOTopAlert.a */; };
AE41FC671F6248BE00959ED0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AE41FC661F6248BE00959ED0 /* main.m */; };
AE41FC6A1F6248BE00959ED0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AE41FC691F6248BE00959ED0 /* AppDelegate.m */; };
AE41FC6D1F6248BE00959ED0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AE41FC6C1F6248BE00959ED0 /* ViewController.m */; };
Expand All @@ -18,6 +19,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
5BB6B0195FDE5C7EB23FD15C /* Pods-RKOTopAlert.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RKOTopAlert.release.xcconfig"; path = "Pods/Target Support Files/Pods-RKOTopAlert/Pods-RKOTopAlert.release.xcconfig"; sourceTree = "<group>"; };
63CC9D40FCCB57CBBFFD5E74 /* libPods-RKOTopAlert.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RKOTopAlert.a"; sourceTree = BUILT_PRODUCTS_DIR; };
AE41FC621F6248BE00959ED0 /* RKOTopAlert.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RKOTopAlert.app; sourceTree = BUILT_PRODUCTS_DIR; };
AE41FC661F6248BE00959ED0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
AE41FC681F6248BE00959ED0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand All @@ -31,24 +34,37 @@
AE41FC7D1F6248CF00959ED0 /* RKOTopAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKOTopAlert.h; sourceTree = "<group>"; };
AE41FC7E1F6248CF00959ED0 /* RKOTopAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKOTopAlert.m; sourceTree = "<group>"; };
AEE5A8821FAC3C830010688D /* icon.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = icon.bundle; sourceTree = "<group>"; };
CB1D1EFFB1454CDD0D18973E /* Pods-RKOTopAlert.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RKOTopAlert.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RKOTopAlert/Pods-RKOTopAlert.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
AE41FC5F1F6248BE00959ED0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0A209D08867A750CF3EEF438 /* libPods-RKOTopAlert.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
6CC861756A64273DE623A138 /* Pods */ = {
isa = PBXGroup;
children = (
CB1D1EFFB1454CDD0D18973E /* Pods-RKOTopAlert.debug.xcconfig */,
5BB6B0195FDE5C7EB23FD15C /* Pods-RKOTopAlert.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
AE41FC591F6248BE00959ED0 = {
isa = PBXGroup;
children = (
AE41FC641F6248BE00959ED0 /* RKOTopAlert */,
AE41FC631F6248BE00959ED0 /* Products */,
6CC861756A64273DE623A138 /* Pods */,
E44495F44F736290E480AC8E /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -95,16 +111,27 @@
path = RKOTopAlert;
sourceTree = "<group>";
};
E44495F44F736290E480AC8E /* Frameworks */ = {
isa = PBXGroup;
children = (
63CC9D40FCCB57CBBFFD5E74 /* libPods-RKOTopAlert.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
AE41FC611F6248BE00959ED0 /* RKOTopAlert */ = {
isa = PBXNativeTarget;
buildConfigurationList = AE41FC791F6248BE00959ED0 /* Build configuration list for PBXNativeTarget "RKOTopAlert" */;
buildPhases = (
1B04AB495B7EB4A8F38BA389 /* [CP] Check Pods Manifest.lock */,
AE41FC5E1F6248BE00959ED0 /* Sources */,
AE41FC5F1F6248BE00959ED0 /* Frameworks */,
AE41FC601F6248BE00959ED0 /* Resources */,
005DCB23089F3DB6143D1BEE /* [CP] Embed Pods Frameworks */,
295CE01B97BF8028C5E42D16 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -121,7 +148,7 @@
AE41FC5A1F6248BE00959ED0 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0920;
ORGANIZATIONNAME = Rakuyo;
TargetAttributes = {
AE41FC611F6248BE00959ED0 = {
Expand Down Expand Up @@ -163,6 +190,54 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
005DCB23089F3DB6143D1BEE /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RKOTopAlert/Pods-RKOTopAlert-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
1B04AB495B7EB4A8F38BA389 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
295CE01B97BF8028C5E42D16 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RKOTopAlert/Pods-RKOTopAlert-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
AE41FC5E1F6248BE00959ED0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -207,15 +282,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -255,15 +336,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -289,6 +376,7 @@
};
AE41FC7A1F6248BE00959ED0 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CB1D1EFFB1454CDD0D18973E /* Pods-RKOTopAlert.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 5C9JW4S9DE;
Expand All @@ -301,6 +389,7 @@
};
AE41FC7B1F6248BE00959ED0 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5BB6B0195FDE5C7EB23FD15C /* Pods-RKOTopAlert.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 5C9JW4S9DE;
Expand Down
6 changes: 5 additions & 1 deletion RKOTopAlertManager/RKOTopAlert/RKOTopAlert/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ @implementation AppDelegate

#pragma mark - Top Alert
- (RKOTopAlert *)topAlert {
return [RKOTopAlert alertViewWithText:@"在AppDelegate中总体设置" textColor:[UIColor blackColor] backgroundColor:[UIColor orangeColor] iconImageName:nil];
return [RKOTopAlert alertViewWithText:@"在AppDelegate中总体设置"
textColor:[UIColor blackColor]
backgroundColor:[UIColor orangeColor]
iconImageName:nil
font:[UIFont systemFontOfSize:15.0f]];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
Expand Down
Loading

0 comments on commit 114f257

Please sign in to comment.