测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可 | MIT |
发布了最新版本 | 2016年6月 |
由 Guarana Technologies Inc. 维护。
这个库是由 www.guarana.io 创建的
这个库非常易于使用,允许您以很好的方式与用户交互,同时保留屏幕的审美。
pod 'GRNAlertView', '~> 1.0'
点击此处获取有关 Cocoapods 及如何安装的更多信息
将 GRNAlertView 文件夹拖拽到您的项目中。
实例化您的 AlertContoller
注意:如果您只想要一个按钮,只需让 rightButtonTitle 字符串为空。
AlertController * alert = [[AlertController alloc] initWithTitle:@"My Title" subTitle:@"With a sub-title here" content:@"This is an alert view whith image Type some content here." leftButtonTitle:@"OK" rightButtonTitle:@"" andImage:[UIImage imageNamed:@"globe"]];
设置按钮动作
[alert setLeftButtonAction:^(AlertController * controller) {
// Do something here
}];
[alert setRightButtonAction:^(AlertController *controller) {
// Do something here
}];
如下显示警报
[alert showOn:self];
设置您想要的背景类型
alert.backgroundType = BackgroundTypeTransparentLight;
BackgroundTypeDefault(背景透明)
BackgroundTypeTransparentLight(背景为带透明度的白色)
//label text colors
titleColor
subtitleColor
contentColor
//button tint colors
leftButtonColor
rightButtonColor
//background of the alertview frame
alertBackgroundColor
//background of the buttons
leftButtonBackgroundColor
rightButtonBackgroundColor
//alertview radius
cornerRadius
//alertview shadow opacity
shadowOppacity
//alertview shadow spread
shadowSpread