AlertView动画

效果

源码

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 = .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

细节

动画效果是基于一个抽象的基类实现的。

AlertView动画的更多相关文章

  1. iOS自定义AlertView 与 ActionSheet 遮罩提示+弹出动画

    产品大人总是能够想到很多让人欣慰的点子,基本所有能提示的地方都要很多文案啊图片之类 由此封装了一个半透明黑色遮罩的alert类(假装有图.jpg) 代码略糙,just share (逃 下载链接

  2. iOS 第三方自定义Alertview项目MBProcessHud中的重要代码分析

    做ios,弹出一个自定义的alertview挺常见的.ios7以前,我们可以对系统的UIAlertView进行一点操作,实现一点简单的定制,但是ios7不再允许我们这样做了.因此,我们需要自己创建一个 ...

  3. IOS自定义alertview

    在家闲来无事,于是就看起来ios绘图的那块,写点什么好呢? 鼓捣了一会,总算写出了一个小东西 这个是写完以后的效果 这里我实现了三种款式的alertview 分别是成功,错误和警告,剩下的呢有空继续添 ...

  4. iOS开发——自定义AlertView

    自定义的AlertView,可以选择出现的动画方式,正文信息高度自动变化,特意做了几个可以对比.没啥难点,直接上代码,一看就懂. 1.在YYTAlertView.h文件中 // //  YYTAler ...

  5. GitHub中最强大的iOS Notifications和AlertView框架,没有之一!

    FFToast是一个非常强大的iOS message notifications和AlertView扩展.它可以很容易实现从屏幕顶部.屏幕底部和屏幕中间弹出一个通知.你可以很容易的自定义弹出的View ...

  6. Swift实现UIKit Dynamic动画

    iOS7引入了UIKit Dynamics,可以帮助开发者开发出更接近真实世界的动画效果.之前,用户如果要做出这样的效果,需要话很多的时间在物理计算和Core Animation上.现在,所有的一切都 ...

  7. iOS - 自己定义alertView,继承自UIView,能够加入子视图,标题图片+文字

    这个更简单,能够看下demo       https://github.com/DYLAN-LWB/WBAlertView 自己定义alertView,继承自UIView,能够在消息区域加入子视图:a ...

  8. iOS补位动画、沙漏效果、移动UITableViewCell、模拟贪吃蛇、拖拽进度等源码

    iOS精选源码 JHAlertView - 一款黑白配色的HUD之沙漏效果 继承UIButton的自定义按钮SPButton 用递归算法实现iOS补位动画 iOS 长按移动UITableViewCel ...

  9. 动画requestAnimationFrame

    前言 在研究canvas的2D pixi.js库的时候,其动画的刷新都用requestAnimationFrame替代了setTimeout 或 setInterval 但是jQuery中还是采用了s ...

随机推荐

  1. Kubernetes监控:部署Heapster、InfluxDB和Grafana

    本节内容: Kubernetes 监控方案 Heapster.InfluxDB和Grafana介绍 安装配置Heapster.InfluxDB和Grafana 访问 grafana 访问 influx ...

  2. 一步一步学习IdentityServer3 (10)

    在某些服务器环境下 identityserver3 会闹情绪, 比如在google浏览器下授权失败(陷入死循环) 查了很多资料好像然并卵 Microsoft.Owin.Security.Notific ...

  3. Android 中.aar文件生成方法与用法

    https://i.cnblogs.com/EditPosts.aspx?opt=1 无论是用Eclipse还是用Android Studio做android开发,都会接触到jar包,全称应该是:Ja ...

  4. scrapy 设置cookie池

    代码已经很详细了,可以直接拿来使用了. 包含了: 从网页获取cookie 存入mongodb 定期删除cookie scrapy中间件对cookie池的取用 #!/usr/bin/python #co ...

  5. 【LOJ】#2052. 「HNOI2016」矿区

    题解 之前尝试HNOI2016的时候弃坑的一道,然后给补回来 (为啥我一些计算几何就写得好长,不过我写啥都长orz) 我们尝试给这个平面图分域,好把这个平面图转成对偶图 怎么分呢,我今天也是第一次会 ...

  6. 【ARC066】F - Contest with Drinks Hard

    题解 我写的斜率维护,放弃了我最擅长的叉积维护,然后发现叉积维护也不会爆long long哦-- 一写斜率维护我的代码就会莫名变长而且难写--行吧 我们看这题 推了推式子,发现这是个斜率的式子,但是斜 ...

  7. MVC设计模式一

    一:基础知识 1.mvc model view control 2.模型 是应用程序的主体部分,模型表示业务数据与业务逻辑. 一个模型可以为多个视图提供数据 提高了代码的可重用性 3.视图 用户看到的 ...

  8. Spark入门3(累加器和广播变量)

    一.概要 通常情况下,当向Spark操作传递一个函数时,它会在一个远程集群节点上执行,它会使用函数中所有变量的副本.这些变量被复制到所有的机器上,远程机器上并没有被更新的变量会向驱动程序回传.在任务之 ...

  9. 同步 Visual Studio Code 的设置与插件

    工具推荐:Settings Sync. 小心有坑! VS Code 没有账号系统,所以设置不能同步,在多终端使用时不是很方便. 有一款插件能做这个事情:Settings Sync - Visual S ...

  10. 虚拟机zookeeper和hbase集群搭建

    集群zookeeper dataDir=/usr/local/zookeeper/dataDir dataLogDir=/usr/local/zookeeper/dataLogDir # the po ...