400行代码实现的简易UIAlertView,添加动画,虚化效果。接口文件中没有对视图的更多的视图属性开放接口,使用过程中可以根据自己的需求进行自定义接口。
与系统UIAlertView的初始化、显示、委托方法相同,多添加动画接口animationOption
@interface STAlertView : UIView
- (instancetype)initWithTitle:(nullable NSString *)title message:(nullable NSString *)message delegate:(nullable id <STAlertViewDelegate>)delegate cancelButtonTitle:(nullable NSString *)cancelButtonTitle otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
+ (void)showWithTitle:(nullable NSString *)title message:(nullable NSString *)message cancelButtonTitle:(nullable NSString *)cancelButtonTitle otherButtonTitle:(nullable NSString *)otherButtonTitle clickButtonBlock:(void (^)(STAlertView *alertView, NSUInteger buttonIndex))block;
// shows popup alert animated.
- (void)show;
@property(nullable,nonatomic,weak)id <STAlertViewDelegate> delegate;
@property(nonatomic)STAlertAnimationOptions animationOption;
// background visual
@property(nonatomic, assign)BOOL visual;
@end
- 添加visual接口,不想使用虚化可以设置为NO
- 添加一行代码处理
+ (void)showWithTitle:(nullable NSString *)title
message:(nullable NSString *)message
cancelButtonTitle:(nullable NSString *)cancelButtonTitle
otherButtonTitle:(nullable NSString *)otherButtonTitle
clickButtonBlock:(void (^)(STAlertView *alertView, NSUInteger buttonIndex))block;
- 支持iOS8以上
- 添加动画,Zoom和TopToCenter动画
- 支持虚化背景