AlertView动画
2016-01-02 11:06
183 查看
AlertView动画
![](http://images2015.cnblogs.com/blog/607542/201601/607542-20160102110001073-79344629.gif)
效果
![](http://images2015.cnblogs.com/blog/607542/201601/607542-20160102110021729-1599402504.gif)
源码
https://github.com/YouXianMing/Animations
细节
动画效果是基于一个抽象的基类实现的。
![](http://images2015.cnblogs.com/blog/607542/201601/607542-20160102110001073-79344629.gif)
效果
![](http://images2015.cnblogs.com/blog/607542/201601/607542-20160102110021729-1599402504.gif)
源码
https://github.com/YouXianMing/Animations
// // AbstractAlertView.h // Animations // // Created by YouXianMing on 16/1/2. // Copyright © 2016年 YouXianMing. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @class AbstractAlertView; @protocol AbstractAlertViewDelegate <NSObject> /** * The AlertView's event. * * @param alertView The AlertViewProtocol object. * @param event Event data. * @param index Event index. */ - (void)alertView:(AbstractAlertView *)alertView data:(id)data atIndex:(NSInteger)index; @end @interface AbstractAlertView : UIView /** * The AlertView event delegate. */ @property (nonatomic, weak) id <AbstractAlertViewDelegate> delegate; /** * The title, default is nil. */ @property (nonatomic, strong) NSString *title; /** * The subtitle, default is nil. */ @property (nonatomic, strong) NSString *subTitle; /** * The message, default is nil. */ @property (nonatomic, strong) NSString *message; /** * Button's title array, default is nil. */ @property (nonatomic, strong) NSArray <NSString *> *buttonsTitle; /** * The contentView. */ @property (nonatomic, weak) UIView *contentView; /** * Auto hiden or not, default is NO. */ @property (nonatomic) BOOL autoHiden; /** * If The autoHiden is YES, you should set the delay hiden duration, default is 2.0. */ @property (nonatomic) NSTimeInterval delayAutoHidenDuration; /** * Show the AlertView. */ - (void)show; /** * Hide the AlertView. */ - (void)hide; /** * Store View with key. * * @param view View. * @param key Key. */ - (void)setView:(UIView *)view ForKey:(NSString *)key; /** * Get View with key. * * @param key Key. * * @return View. */ - (UIView *)viewWithKey:(NSString *)key; @end
// // AbstractAlertView.m // Animations // // Created by YouXianMing on 16/1/2. // Copyright © 2016年 YouXianMing. All rights reserved. // #import "AbstractAlertView.h" @interface AbstractAlertView () @property (nonatomic, strong) NSMapTable *mapTable; @end @implementation AbstractAlertView - (instancetype)init { if (self = [super init]) { self.delayAutoHidenDuration = 2.f; self.autoHiden = NO; self.mapTable = [NSMapTable strongToWeakObjectsMapTable]; } return self; } - (void)show { [NSException raise:@"AlertViewProtocol" format:@"Cannot use show method from subclass."]; } - (void)hide { [NSException raise:@"AlertViewProtocol" format:@"Cannot use hide method from subclass."]; } - (void)setView:(UIView *)view ForKey:(NSString *)key { [self.mapTable setObject:view forKey:key]; } - (UIView *)viewWithKey:(NSString *)key { return [self.mapTable objectForKey:key]; } @end
细节
动画效果是基于一个抽象的基类实现的。
相关文章推荐
- blink接收器
- tshark过滤并保存包特定字段
- 快来嗨!《笑傲江湖ol》圣诞嘉韶华狂欢开端!--国民网游戏
- java成员方法
- 停用两个模块并发现一个奇怪的注释问题
- Android:Sqlitedatabase学习小结
- 适配器模式
- AngularJS 教程 - CodePreject
- 有道词典不能联网解决方法
- Spart内核天机解密(2016)第一讲 Scala光速入门
- Android 6.0设置模块免打扰功能浅析
- codefoeces B 397 - On Corruption and Numbers
- 图标变成圆角
- io cache
- Win7 64位安装JDK的步骤,并且附上测试程序
- CGRectInset CGRectoffset UIEdgeInsetsInsetRect 这三个函数的使用情况
- css中的长度
- 记一次 JS 模拟 CSS active 效果的过程
- Linux设备驱动中的ioctl
- java初始化之变量初始化