GoogleWearAlert 项目使用教程

随笔3周前发布 鹜迟
39 0 0

GoogleWearAlert 项目使用教程

GoogleWearAlertAn Android Wear style confirmation view for iOS项目地址:https://gitcode.com/gh_mirrors/go/GoogleWearAlert

1、项目的目录结构及介绍

GoogleWearAlert 项目的目录结构如下:

  1. GoogleWearAlert

  2. ├── GoogleWearAlert.xcodeproj

  3. ├── GoogleWearAlert

  4. │ ├── GoogleWearAlertView.h

  5. │ ├── GoogleWearAlertView.m

  6. │ ├── ...

  7. ├── GoogleWearAlertTests

  8. │ ├── ...

  9. ├── README.md

  10. ├── LICENSE

目录介绍

  • GoogleWearAlert.xcodeproj: Xcode 项目文件。
  • GoogleWearAlert: 包含项目的主要源代码文件,如 GoogleWearAlertView.hGoogleWearAlertView.m
  • GoogleWearAlertTests: 包含项目的测试文件。
  • README.md: 项目的说明文档。
  • LICENSE: 项目的许可证文件。

2、项目的启动文件介绍

项目的启动文件位于 GoogleWearAlert 目录下,主要包括:

  • GoogleWearAlertView.h: 定义了 GoogleWearAlert 视图的接口。
  • GoogleWearAlertView.m: 实现了 GoogleWearAlert 视图的功能。

启动文件介绍

  • GoogleWearAlertView.h:

    1. #import <UIKit/UIKit.h>

    2. typedef NS_ENUM(NSInteger, GoogleWearAlertType) {

    3. Success,

    4. Error,

    5. Warning,

    6. Message

    7. };

    8. @interface GoogleWearAlertView : UIView

    9. + (void)showAlert:(NSString *)title type:(GoogleWearAlertType)type;

    10. + (void)showAlert:(NSString *)title image:(UIImage *)image type:(GoogleWearAlertType)type duration:(NSTimeInterval)duration inViewController:(UIViewController *)viewController;

    11. @end

  • GoogleWearAlertView.m:

    1. #import "GoogleWearAlertView.h"

    2. #import <QuartzCore/QuartzCore.h>

    3. @implementation GoogleWearAlertView

    4. + (void)showAlert:(NSString *)title type:(GoogleWearAlertType)type {

    5. [self showAlert:title image:nil type:type duration:2.0 inViewController:[UIApplication sharedApplication].keyWindow.rootViewController];

    6. }

    7. + (void)showAlert:(NSString *)title image:(UIImage *)image type:(GoogleWearAlertType)type duration:(NSTimeInterval)duration inViewController:(UIViewController *)viewController {

    8. // 实现代码

    9. }

    10. @end

3、项目的配置文件介绍

项目的配置文件主要包括 GoogleWearAlert.xcodeprojREADME.md

配置文件介绍

  • GoogleWearAlert.xcodeproj:

    • 包含了项目的所有配置信息,如编译设置、构建设置、依赖库等。
  • README.md:

    • 提供了项目的详细说明,包括如何安装、如何使用、示例代码等。
  1. # GoogleWearAlert

  2. An Android Wear style confirmation view for iOS with #Objective-C

  3. ## Installation

  4. Drag the "GoogleWearAlertView" folder from the example project into your project. This library requires ARC.

  5. ## Usage

  6. To show notifications use the following code:

  7. ```objc

  8. // Basic init

  9. [GoogleWearAlert showAlert: @"Success" type: Success];

  10. // Convenience init

  11. [GoogleWearAlert showAlert: @"Error" image: nil type: Error duration: 2.0 inViewController: self];

  12. // Full init

  13. [GoogleWearAlert showAlert: @"Message" image: nil type: Message duration: 2.0 inViewController: self];

  1. 以上是 GoogleWearAlert 项目的使用教程,包含了项目的目录结构、启动文件和配置文件的介绍。希望对您有所帮助。

GoogleWearAlertAn Android Wear style confirmation view for iOS项目地址:https://gitcode.com/gh_mirrors/go/GoogleWearAlert

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...