简单直观的警告视图。类似于推送通知效果。此类使用 UIAlertView 的默认方法和协议。
NZAlertView 适用于 iOS 6.0+ 版本,并与 ARC 项目兼容。它依赖于以下苹果框架,这些框架应已包含在大多数 Xcode 模板中
要构建 NZAlertView,您需要 LLVM 3.0 或更高版本。
NZAlertView 使用 UIImage-Helpers 仓库操作图像。
或者您可以直接将源文件添加到您的项目中。
NZAlertView
文件夹中拖拽所有文件到您的项目上(使用“产品导航视图”)。如果从项目外部提取了代码归档,请确保在询问时选择复制项目。#import "NZAlertView.h"
...
{
// There are several ways to init, just look at the class header
NZAlertView *alert = [[NZAlertView alloc] initWithStyle:NZAlertStyleSuccess
title:@"Alert View"
message:@"This is an alert example."
delegate:nil];
[alert setTextAlignment:NSTextAlignmentCenter];
[alert show];
// or
[alert showWithCompletion:^{
NSLog(@"Alert with completion handler");
}];
}
#import "NZAlertViewDelegate.h"
...
- (void)willPresentNZAlertView:(NZAlertView *)alertView;
- (void)didPresentNZAlertView:(NZAlertView *)alertView;
- (void)NZAlertViewWillDismiss:(NZAlertView *)alertView;
- (void)NZAlertViewDidDismiss:(NZAlertView *)alertView;
@property (nonatomic, assign) id delegate;
@property (nonatomic, assign) NZAlertStyle alertViewStyle;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *message;
@property (nonatomic, readonly, getter = isVisible) BOOL visible;
@property (nonatomic, assign) NSString *fontName;
@property (nonatomic) NSTextAlignment textAlignment;
@property (nonatomic, assign) CGFloat alertDuration;
@property (nonatomic, assign) CGFloat animationDuration;
@property (nonatomic, assign) CGFloat screenBlurLevel;
NZAlertView-Icons.budle
NZAlertViewColor
类,并重写以下方法: errorColor
,infoColor
和 successColor
。此代码是根据 MIT 许可证的条款和条件进行分发的。
可以在 wiki 上找到每个 NZAlertView 版本的简要总结。
NZAlertStyleCustom
风格