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 201703-4 地铁修建

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

  2. day2编写购物商城

    作业:购物商城 商品展示,价格 买,加入购物车 付款,钱不够 流程图如下: 代码共有4个文件,如下: 用户文件: alex geng zhang lou zeng 商品文件: 小米3 比亚迪宋 格力变 ...

  3. Linux下光盘镜像生成和刻录

    mkiosfs命令如在/root/下有文件file1 file2 file3maiosfs -o img.ios file1 file2 file3该命令将file1 file2 file3放入到im ...

  4. 【LOJ】#2542. 「PKUWC2018」随机游走

    题解 虽然我知道minmax容斥,但是--神仙能想到把这个dp转化成一个一次函数啊= = 我们相当于求给定的\(S\)集合里最后一个被访问到的点的时间,对于这样的max的问题,我们可以用容斥把它转化成 ...

  5. PCA(Principal Component Analysis)主成分分析

    PCA的数学原理(非常值得阅读)!!!!   PCA(Principal Component Analysis)是一种常用的数据分析方法.PCA通过线性变换将原始数据变换为一组各维度线性无关的表示,可 ...

  6. SIlkTest入门

    http://bbs.51testing.com/thread-983434-1-1.html

  7. Django第一步

    对于一个web框架,掌握了三部分的内容,就可以说是迈出了第一步. 1. 准备开发环境 2. 创建一个工程,并运行 3. 开发hello world应用 1. 准备环境 首先应该是安装python和dj ...

  8. IOS 本地推送

    // 1.打开本地推送并设置属性 NSString *str = @"本地推送的信息"; UIApplication *app = [UIApplication sharedApp ...

  9. 部署 LAMP

    部署 LAMP https://help.aliyun.com/document_detail/50774.html?spm=a2c4g.11186623.6.773.Em8xVc 文档提供方:上海驻 ...

  10. OSPF详解

    OSPF 详解 (1) [此博文包含图片] (2013-02-04 18:02:33) 转载 ▼ 标签: 端的 第二 以太 第一个 正在 目录 序言 初学乍练 循序渐进学习OSPF 朱皓 入门之前 了 ...