RGLAlertView 0.1

RGLAlertView 0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年3月

Ramon Gilabert 维护。



呈现警报视图的一个好方法,添加颜色、文本,使用图片自定义,所有这一切都和添加一个字符串一样简单。

特性

  • 就像输入一个字符串那么简单。
  • 适应所有设备,动态计算大小。
  • 带有多种动画来呈现警报。
  • 知道哪个按钮被点击了。
  • 在警报中添加最多 3 个按钮。
  • 添加图片来自定义它。

使用方法

将主文件导入您的 Xcode 项目,并在需要显示视图的控制台中导入它

#import "RGLAlertView.h"

在您希望显示的视图中实例化视图并显示它。

创建一个简单的警报

RGLAlertView *view = [[RGLAlertView alloc] initWithBodyMessage:@"This is an alert view with a title" andDismissButtonText:@"Dismiss"];
[view setTitle:@"Alert with title"];
[view presentAlertViewWithAnimation:0];

向警报中添加更多信息

RGLAlertView *view = [[RGLAlertView alloc] initWithBodyMessage:@"This is an alert view with a title" andDismissButtonText:@"Dismiss"];
[view setTitle:@"Alert with title"];
[view setBody:@"This is some random text, funny thing about it is that, based in my size, the alert is going to get bigger and bigger!"];
[view addButtonWithTitle:@"Touch"];
[view addImageInTop:[UIImage imageNamed:@"firstImage"]];
[view presentAlertViewWithAnimation:0];

使用代理

有了代理,您将能够知道哪个按钮被点击。这很简单

view.delegate = self;

然后调用方法

- (void)buttonDidPressedWithTitle:(NSString *)string
{
    NSLog(@"%@", string);
}
- (void)buttonDismissDidPressed
{

}

示例

RGLAlertView

即将到来的功能

  • TextField 支持,您将在键入时能够监听一些方法。
  • 向警报视图中添加自定义字体。
  • 更多自定义(想法?)。

贡献

  1. 分叉它。
  2. 创建您的分支(使用 git checkout -b feature-branch)。
  3. 提交您的更改(使用 git commit -am 'Added this feature')。
  4. 将变更推送到分支(使用 git push origin feature-branch)。
  5. 创建新的拉取请求。

完成

Ramon Gilabert 用爱! :)