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. nsis安装包_示例脚本语法解析

    以下是代码及解析,其中有底色的部分为脚本内容. 注释.!define.变量.!include.常量 ; Script generated by the HM NIS Edit Script Wizar ...

  2. CCF CSP 201703-4 地铁修建

    博客中的文章均为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201703-4 地铁修建   问题描述 A市有n个交通枢纽,其中1号和n号非常重要,为了加强运输能力,A市决定在1号到n ...

  3. drools7 (三、kmodule 介绍)

    注意几点: 1. kmodule 有默认的加载路径, 看  KieModuleModelImpl 这个类的源代码 public class KieModuleModelImpl implements ...

  4. Maven 仓库之阿里云镜像配置

    每当项目开发中 update Maven Project 的时候,我们会发现那个进度是非常的慢,这也严重阻碍了平日的开发进度.        然而,殊不知阿里云搭建了一个国内镜像 http://mav ...

  5. spring boot配置使用fastjson

    一.前言 spring boot默认使用jackson来操作json数据,相比于jackson,fastjson更好用,功能也强大,所以这里记录一下在spring boot中配置使用fastjson的 ...

  6. ref:Mysql授权远程登陆

    ref:https://blog.csdn.net/qq_26710805/article/details/79776897 在Windows环境上操作.步骤如下: 1. 打开cmd窗口,登陆mysq ...

  7. 【20181031T1】一串数字【分解质因数+贪心】

    题面 [错解] 立方就是所有质因子次数都是3的倍数嘛 发现1e5的三次根很小,可以枚举所有和这个数乘起来是完全立方数的(flag*1) 然后--连条边跑最大独立集? 不对啊是NP问题(实际上是个二分图 ...

  8. Educational Codeforces Round 13 B. The Same Calendar 水题

    B. The Same Calendar 题目连接: http://www.codeforces.com/contest/678/problem/B Description The girl Tayl ...

  9. JavaScript惰性函数定义

    函数是js世界的一等公民,js的动态性.易变性在函数的应用上,体现的淋漓尽致.做为参数,做为返回值等,正是函数这些特性,使得js开发变的有趣. 下面就阐述一下,js一个有趣的应用--惰性函数定义(La ...

  10. 使用TensorFlow低级别的API进行编程

    Tensorflow的低级API要使用张量(Tensor).图(Graph).会话(Session)等来进行编程.虽然从一定程度上来看使用低级的API非常的繁重,但是它能够帮助我们更好的理解Tenso ...