AlertView动画
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动画的更多相关文章
- iOS自定义AlertView 与 ActionSheet 遮罩提示+弹出动画
产品大人总是能够想到很多让人欣慰的点子,基本所有能提示的地方都要很多文案啊图片之类 由此封装了一个半透明黑色遮罩的alert类(假装有图.jpg) 代码略糙,just share (逃 下载链接
- iOS 第三方自定义Alertview项目MBProcessHud中的重要代码分析
做ios,弹出一个自定义的alertview挺常见的.ios7以前,我们可以对系统的UIAlertView进行一点操作,实现一点简单的定制,但是ios7不再允许我们这样做了.因此,我们需要自己创建一个 ...
- IOS自定义alertview
在家闲来无事,于是就看起来ios绘图的那块,写点什么好呢? 鼓捣了一会,总算写出了一个小东西 这个是写完以后的效果 这里我实现了三种款式的alertview 分别是成功,错误和警告,剩下的呢有空继续添 ...
- iOS开发——自定义AlertView
自定义的AlertView,可以选择出现的动画方式,正文信息高度自动变化,特意做了几个可以对比.没啥难点,直接上代码,一看就懂. 1.在YYTAlertView.h文件中 // // YYTAler ...
- GitHub中最强大的iOS Notifications和AlertView框架,没有之一!
FFToast是一个非常强大的iOS message notifications和AlertView扩展.它可以很容易实现从屏幕顶部.屏幕底部和屏幕中间弹出一个通知.你可以很容易的自定义弹出的View ...
- Swift实现UIKit Dynamic动画
iOS7引入了UIKit Dynamics,可以帮助开发者开发出更接近真实世界的动画效果.之前,用户如果要做出这样的效果,需要话很多的时间在物理计算和Core Animation上.现在,所有的一切都 ...
- iOS - 自己定义alertView,继承自UIView,能够加入子视图,标题图片+文字
这个更简单,能够看下demo https://github.com/DYLAN-LWB/WBAlertView 自己定义alertView,继承自UIView,能够在消息区域加入子视图:a ...
- iOS补位动画、沙漏效果、移动UITableViewCell、模拟贪吃蛇、拖拽进度等源码
iOS精选源码 JHAlertView - 一款黑白配色的HUD之沙漏效果 继承UIButton的自定义按钮SPButton 用递归算法实现iOS补位动画 iOS 长按移动UITableViewCel ...
- 动画requestAnimationFrame
前言 在研究canvas的2D pixi.js库的时候,其动画的刷新都用requestAnimationFrame替代了setTimeout 或 setInterval 但是jQuery中还是采用了s ...
随机推荐
- C# 在RichTextBox根据内容自动调整高度
private void richTextBox1_ContentsResized(object sender, ContentsResizedEventArgs e) { richTextB ...
- 一步一步学习IdentityServer3 (15) 授权模式那些事
总结一句话,其实很简单 在什么Clients 拿的认证权限Scope 就去 去开什么Scope限制的服务接口门 在写Clients的时候,会有Scope,看下面的代码 new Client { Cli ...
- ASP.NET WebAPI 01-Demo
WebAPI作为构建RESTful的平台出来有段时间了,加上最近也在用,所以想把自己的心得记录下来.我就以一个简单的增删查改作为开篇. 准备 实体类(Figure)的定义. public class ...
- 喜大普奔!Django官方文档终于出中文版了
喜大普奔!Django官方文档终于出中文版了 文章来源:企鹅号 - Crossin的编程教室 昨天经 Sur 同学告知才发现,Django 官方文档居然支持中文了! 之所以让我觉得惊喜与意外,是因为: ...
- 学习 HMM
简介 HMM 中的变量可以分为两组. 第一组是状态变量 \(\{y_i,y_2,\cdots, y_n\}\), 其中 \(y_i \in \mathcal{Y}\) 表示第 \(i\) 时刻的系统状 ...
- with上下文管理器
术语 要使用 with 语句,首先要明白上下文管理器这一概念.有了上下文管理器,with 语句才能工作. 下面是一组与上下文管理器和with 语句有关的概念. 上下文管理协议(Context Mana ...
- C# 集合类-使用
关联性集合类 关联性集合类即我们常说的键值对集合,允许我们通过Key来访问和维护集合. 我们来看一下 .net 为我们提供了哪些泛型的关联性集合类: Dictionary<TKey,TValu ...
- Java并发(二十):线程本地变量ThreadLocal
ThreadLocal是一个本地线程副本变量工具类. 主要用于将私有线程和该线程存放的副本对象做一个映射,各个线程之间的变量互不干扰,在高并发场景下,可以实现无状态的调用,特别适用于各个线程依赖不同的 ...
- MAC下安装多版本JDK和切换几种方式
环境: MAC AIR,OS X 10.10,64位 历史: 过去 Mac 上的 Java 都是由 Apple 自己提供,只支持到 Java 6,并且OS X 10.7 开始系统并不自带(而是可选 ...
- elasticsearch 亿级数据检索案例与原理
版权说明: 本文章版权归本人及博客园共同所有,转载请标明原文出处( https://www.cnblogs.com/mikevictor07/p/10006553.html ),以下内容为个人理解,仅 ...