GoogleWearAlert 项目使用教程
GoogleWearAlertAn Android Wear style confirmation view for iOS项目地址:https://gitcode.com/gh_mirrors/go/GoogleWearAlert
1、项目的目录结构及介绍
GoogleWearAlert 项目的目录结构如下:
GoogleWearAlert
├── GoogleWearAlert.xcodeproj
├── GoogleWearAlert
│ ├── GoogleWearAlertView.h
│ ├── GoogleWearAlertView.m
│ ├── ...
├── GoogleWearAlertTests
│ ├── ...
├── README.md
├── LICENSE
目录介绍
GoogleWearAlert.xcodeproj
: Xcode 项目文件。GoogleWearAlert
: 包含项目的主要源代码文件,如GoogleWearAlertView.h
和GoogleWearAlertView.m
。GoogleWearAlertTests
: 包含项目的测试文件。README.md
: 项目的说明文档。LICENSE
: 项目的许可证文件。
2、项目的启动文件介绍
项目的启动文件位于 GoogleWearAlert
目录下,主要包括:
GoogleWearAlertView.h
: 定义了 GoogleWearAlert 视图的接口。GoogleWearAlertView.m
: 实现了 GoogleWearAlert 视图的功能。
启动文件介绍
-
GoogleWearAlertView.h
:#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, GoogleWearAlertType) {
Success,
Error,
Warning,
Message
};
@interface GoogleWearAlertView : UIView
+ (void)showAlert:(NSString *)title type:(GoogleWearAlertType)type;
+ (void)showAlert:(NSString *)title image:(UIImage *)image type:(GoogleWearAlertType)type duration:(NSTimeInterval)duration inViewController:(UIViewController *)viewController;
@end
-
GoogleWearAlertView.m
:#import "GoogleWearAlertView.h"
#import <QuartzCore/QuartzCore.h>
@implementation GoogleWearAlertView
+ (void)showAlert:(NSString *)title type:(GoogleWearAlertType)type {
[self showAlert:title image:nil type:type duration:2.0 inViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
+ (void)showAlert:(NSString *)title image:(UIImage *)image type:(GoogleWearAlertType)type duration:(NSTimeInterval)duration inViewController:(UIViewController *)viewController {
// 实现代码
}
@end
3、项目的配置文件介绍
项目的配置文件主要包括 GoogleWearAlert.xcodeproj
和 README.md
。
配置文件介绍
-
GoogleWearAlert.xcodeproj
:- 包含了项目的所有配置信息,如编译设置、构建设置、依赖库等。
-
README.md
:- 提供了项目的详细说明,包括如何安装、如何使用、示例代码等。
# GoogleWearAlert
An Android Wear style confirmation view for iOS with #Objective-C
## Installation
Drag the "GoogleWearAlertView" folder from the example project into your project. This library requires ARC.
## Usage
To show notifications use the following code:
```objc
// Basic init
[GoogleWearAlert showAlert: @"Success" type: Success];
// Convenience init
[GoogleWearAlert showAlert: @"Error" image: nil type: Error duration: 2.0 inViewController: self];
// Full init
[GoogleWearAlert showAlert: @"Message" image: nil type: Message duration: 2.0 inViewController: self];
以上是 GoogleWearAlert 项目的使用教程,包含了项目的目录结构、启动文件和配置文件的介绍。希望对您有所帮助。
GoogleWearAlertAn Android Wear style confirmation view for iOS项目地址:https://gitcode.com/gh_mirrors/go/GoogleWearAlert