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. CCF CSP 201412-4 最优灌溉

    CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201412-4 最优灌溉 问题描述 雷雷承包了很多片麦田,为了灌溉这些麦田,雷雷在第一个麦田挖 ...

  2. GUC-9 ReadWriteLock : 读写锁

    import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWrit ...

  3. USACO 5.1 Fencing the Cows

    Fencing the CowsHal Burch Farmer John wishes to build a fence to contain his cows, but he's a bit sh ...

  4. 2017-2018-1 20179202《Linux内核原理与分析》第十二周作业

    C语言实现Linux网络嗅探器 一.知识准备 1.一般情况下,网络上所有的机器都可以"听"到通过的流量,但对不属于自己的数据包则不予响应.如果某个工作站的网络接口处于混杂模式,那么 ...

  5. liniux Crontab 的重启和设置

    重启crontab,service cron restart 05 01 * * * /usr/local/php/bin/php FILE 10,30,50 * * * * /usr/local/p ...

  6. python opencv3 摄像头人脸检测

    git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 def detect(): # 创建人脸检测的对象 ...

  7. 设计模式 结构型模式 外观模式(Facade Pattern)

    在软件开发过程中,客户端程序经常会与复杂系统的内部子系统进行耦合,从而导致客户端程序随着子系统的变化而变化. 这时为了将复杂系统的内部子系统与客户端之间的依赖解耦,从而就有了外观模式,也称作 ”门面“ ...

  8. JS AngualrJs 指令

    本文基于 AngularJs 1.x 版本 内置指令 布尔属性 根据HTML标准的定义,布尔属性代表一个 true 或 false 值. 当这个属性出现时,这个属性的值就是 true (无论实际定义的 ...

  9. 在JSP使用EL中判断指定元素是否存在于指定集合中

    在JSP使用EL中判断指定元素是否存在于指定集合中 1.问题描述 在JSP页面中使用EL表达式判断一个指定元素是否存在于指定集合中? 2.问题解决 eg:指定集合:collection:{1,2,3, ...

  10. 安装第三方jar包的两种方式

    由于部分第三放jar包没有放到maven中央仓库,而项目中又依赖了这些jar包,那么如何安装?我实践了两种,特做记录. 一.安装到 nexus 私有库: 在 3rd party 仓库下有个 Artif ...