GZToast 0.1.3

GZToast 0.1.3

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2016 年 8 月

Samuel ZhaoY 维护。



GZToast 0.1.3

  • 作者
  • zy.zhao

GZToast 是一个toast控件,它使用户能够在iOS应用程序中构建带有三种常见默认样式的toast视图。同时,开发人员还可以轻松插入自定义的toast内容。用户还可以定义自己的弹出时间和完成回调。

本项目现在支持屏幕旋转。

接下来是什么

  • 优化当前示例项目结构,移除未使用的配置文件。
  • 将在后期阶段提供动画优化。
  • 将提供测试用例。

示例

  • 要运行示例项目,首先克隆仓库,然后从示例目录运行 pod install

默认样式1:纯文本 toast

[[GZToastView toastWithText:@"toast style 1"] showForDuration:4
                                                     onCompletion:^{
                                                      NSLog(@"Toast complete");
                                                     }];

默认样式2

[[GZToastView toastWithText:@"toast style 2: icon with corresponding toast description. Adding the long desc to see the overall layout."
                          icon:[UIImage imageNamed:@"Icon.png"]]
     showForDuration:4
        onCompletion:^{
            NSLog(@"Toast complete");
     }];

默认样式3

[[GZToastView toastWithText:@"toast style 3: icon with corresponding toast description. Adding the long desc to see the overall layout."
                          icon:[UIImage imageNamed:@"Icon.png"]
                         title:@"Title"]
     showForDuration:4
     onCompletion:^{
         NSLog(@"Toast complete");
     }];

自定义样式

UIActivityIndicatorView* indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    indicator.frame = CGRectMake(0, 0, 55, 55);
    [indicator startAnimating];
    [[GZToastView toastWithCustomizedContent:indicator] showForDuration:4
                                                           onCompletion:^{
                                                               NSLog(@"Toast complete");
                                                               [indicator stopAnimating];
                                                           }];

功能列表

  • 支持默认 toast 样式:纯文本 toast/图标 + toast 文本/图标 + toast 标题 + toast 文本
  • 与自定义 toast 内容配合良好
  • 自动支持屏幕旋转
  • 提供底部风格/屏幕中央弹出选项

屏幕截图

HTML5 Icon HTML5 Icon
HTML5 Icon HTML5 Icon
HTML5 Icon HTML5 Icon

安装

源代码

由于这是一个小型项目,您也可以复制源代码到您的项目中。

GZToastView.h
GZToastView.m

至您的项目。

samuel.zhao.yue, [email protected]

许可证

Toast 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。