JTAlertView 1.1.0

JTAlertView 1.1.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布上次发布2016年11月

[Jakub] 维护。




JTAlertView 是一种新的 精彩对话框/HUD/警报 类型的视图。它也设计用于满足在 定制 过程中的用户需求。使用图像、视差和弹出效果愉快地结合创建,JTAlertView 提升了您的用户体验。

Example

安装

有两种方法可以将 JTAlertView 库添加到您的项目中。作为常规库添加或通过 CocoaPods 安装。

pod 'JTAlertView'

您还可以使用以下方式快速测试示例项目

pod try JTAlertView

库需要针对 iOS 7.0 及以上版本的目标

可在横竖屏模式下运行

Parallax       Example

使用和自定义

  • 使用 initWithTitle:andImage: 或类方法 alertWithTitle:andImage: 来初始化。
  • 然后你可以使用许多属性,如 overlayColor 来自定义 JTAlertView
  • 然后添加按钮,例如使用 addButtonWithTitle:action:
  • 最后,使用 showhide 方法来处理显示。

简单单按钮示例

JTAlertView *alertView = [[JTAlertView alloc] initWithTitle:@"You are wonderful" andImage:image];
self.alertView.size = CGSizeMake(280, 230);

[self.alertView addButtonWithTitle:@"OK" style:JTAlertViewStyleDefault action:^(JTAlertView *alertView) {
    [alertView hide];
}];

[self.alertView show];

属性

您必须设置 size 属性,否则将使用默认值。popAnimation 在显示时可见,并且当您点击对话框时也会可见。上面给出的 overlayColor 和适当的 titleShadow 使得标题更易于阅读。创建 backgroundShadow 在警报视图下方创建适当的阴影。将应用 font 属性(它是 stylesize)到标题和按钮(仅 style)。要自定义特定按钮,请使用按钮添加方法中的 font 参数(见下文)。

@property (nonatomic, assign) CGSize size;

@property (nonatomic, assign) bool popAnimation;
@property (nonatomic, assign) bool parallaxEffect;
@property (nonatomic, strong) UIColor *overlayColor;

@property (nonatomic, strong) UIFont *font;
@property (nonatomic, strong) UIColor *titleColor;
@property (nonatomic, assign) bool titleShadow;
@property (nonatomic, assign) bool backgroundShadow;

添加按钮

您可以设置按钮的 titleactionBlockstyle(类似于 样式)、controlEventsfont(如有必要)。

- (void)addButtonWithTitle:action:
- (void)addButtonWithTitle:style:action:
- (void)addButtonWithTitle:style:forControlEvents:action:
- (void)addButtonWithTitle:font:style:forControlEvents:action:

显示

您可以使用带有 completion 块的 show 显示 JTAlertView,在特定的 superview 中,animated 并隐藏它,也可以使用 delay

- (void)show
- (void)showInSuperview:withCompletion:animated:

- (void)hide
- (void)hideWithCompletion:animated:
- (void)hideWithDelay:animated:

变更日志

v1.0.2 - 06.23.15

  • [修复] 更新README.md

v1.0.1 - 06.18.15

  • [新增] 添加BackgroundShadow

v1.0.0 - 06.17.15

  • [新增] 初始提交

作者

此库由Jakub Truhlar开源,网址为http://kubatruhlar.cz

许可证

MIT许可(MIT)版权所有 © 2015 Jakub Truhlar