TYAlertView *alertView = [[TYAlertView alloc] initWithTitle:@"title" message:@"message"];
[alertView addAction:[TYAlertAction actionWithTitle:@"Ok"
style:TYAlertActionStyleDefault
handler:^(TYAlertAction * _Nonnull action) {
NSLog(@"Ok button clicked");
}]];
[alertView show];
[TYAlertView appearance].titleColor = [UIColor redColor];
[TYAlertView appearance].messageColor = [UIColor redColor];
[TYAlertView appearance].separatorColor = [UIColor grayColor];
[TYAlertView appearance].shadowRadius = 4.0f;
[TYAlertView appearance].popupViewBackgroundColor = [UIColor blueColor];
// Button Title Color
[[TYAlertView appearance] setButtonTitleColor:[UIColor yellowColor]
forActionStyle:TYAlertActionStyleDefault
forState:UIControlStateNormal];
要运行示例项目,请克隆仓库,然后首先在 Example 目录中运行pod install
TYAlertView 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中
pod "TYAlertView"
TYAlertView
在 MIT
许可证下提供。有关更多信息,请参阅 LICENSE 文件。