声明全局变量

#define kMainBoundsHeight   ([UIScreen mainScreen].bounds).size.height //屏幕的高度
#define kMainBoundsWidth ([UIScreen mainScreen].bounds).size.width //屏幕的宽度
const CGFloat animalDuration = 0.25; //添加动画延时效果

ViewController.m

//
// ViewController.m
// iPhone
//
// Created by zlw on 2018/4/10.
// Copyright © 2018年 xujinzhong. All rights reserved.
// #import "ViewController.h"
#import "Masonry.h"
#import "ReactiveObjC.h"
#import "showV.h" @interface ViewController () @end @implementation ViewController
{
UIButton *_doneBtn;
} - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor whiteColor]; _doneBtn = [[UIButton alloc] init];
_doneBtn.backgroundColor = [UIColor grayColor];
_doneBtn.layer.cornerRadius = ;
_doneBtn.layer.masksToBounds = YES;
[_doneBtn setTitle:@"show" forState:UIControlStateNormal];
[self.view addSubview:_doneBtn]; [_doneBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset();
make.centerX.equalTo(self.view);
make.width.offset();
make.height.offset();
}]; __block showV *_showView;
[[_doneBtn rac_signalForControlEvents:UIControlEventTouchDown]subscribeNext:^(__kindof UIControl * _Nullable x) {
_showView = [[showV alloc] init];
[self.view addSubview:_showView];
_showView.frame = CGRectMake(, , kMainBoundsWidth, kMainBoundsHeight);
[_showView showViewData];
}];
} @end

showV.h

//
// showV.h
// iPhone
//
// Created by zlw on 2018/4/10.
// Copyright © 2018年 xujinzhong. All rights reserved.
// #import <UIKit/UIKit.h> @interface showV : UIView -(void)showViewData; @end

showV.m

//
// showV.m
// iPhone
//
// Created by zlw on 2018/4/10.
// Copyright © 2018年 xujinzhong. All rights reserved.
// #import "showV.h"
#import "Masonry.h"
#import "ReactiveObjC.h" @interface showV () @property(nonatomic, strong) UIView *bkView;
@property(nonatomic, strong) UIVisualEffectView *alphView;
@property(nonatomic, strong) NSString *content; @end @implementation showV -(instancetype)init{
self = [super init]; if (self) {
self.backgroundColor = [UIColor whiteColor];
} return self;
} -(NSString *)content{
if (!_content) {
_content = @"您将要激活闪电下单模式。通过点击下面的“我接受这些合同条款”,您会承认您已经阅读并理解以下合同条款,您同意特此遵守。您当前的程序端版本使您在下面的订单提交模式间选择。您同意遵守本规定的条款和条件,有关这样的模式。\n\n1. 订单提交的默认模式是两步处理法。使用默认模式,您需先选择买卖方向,然后您需要选择一个合适的订单类型,它的参数并且根据您选定的具体订单类型和您的交易意愿,通过点击买入,卖出,下单,确认您订单的提交。使用默认模式,您的订单将直到您完成前面提到的两个步骤才会提交。\n\n2. 订单提交的闪电下单模式是一步处理法。使用闪电下单模式,您的订单将会被直接提交,而无需再次确认。不会有后续确认提示您点击。一旦您点击,您将无法撤销或更改您的订单。在正常市场条件和系统性能下,市价订单提交后,单子会立即成交。\n\n您可以在【开启闪电下单按钮】停用闪电下单模式。\n\n通过选择闪电下单模式,您了解到您的订单将根据您点击卖或买价进行提交,没有后续订单确认。您同意并接受您选择的订单提交模式相关的全部风险,包括,但不限于,过失风险,提交订单时发生的失误。\n\n您同意完全赔偿和使ZLW TRADING 在由您,您的交易经理或任何代表您进行交易的人,造成的任何错误遗漏或失误而导致的结果引起的各种损失,成本和费用上免受损失。\n";
}
return _content;
} -(void)showViewData{
UIColor *bkColor = [UIColor blackColor];
UIColor *whileColor = [UIColor whiteColor];
UIColor *grayColor = [UIColor grayColor]; UIBlurEffect *beffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
_alphView = [[UIVisualEffectView alloc] initWithEffect:beffect];
[self addSubview:_alphView];
_alphView.alpha = ; [_alphView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}]; self.bkView = [[UIView alloc] init];
[self addSubview:self.bkView];
self.bkView.backgroundColor = bkColor;
self.bkView.frame = CGRectMake(, kMainBoundsHeight-, kMainBoundsWidth, ); UILabel *labTitle = [UILabel new];
labTitle.text = @"免责声明";
labTitle.textAlignment = NSTextAlignmentCenter;
labTitle.backgroundColor = bkColor;
labTitle.textColor = whileColor;
[self.bkView addSubview:labTitle]; [labTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self.bkView);
make.width.equalTo(self.bkView);
make.height.offset();
}]; UITextView *textV = [UITextView new];
textV.backgroundColor = bkColor;
textV.textColor = grayColor;
textV.font = [UIFont systemFontOfSize:];
textV.text = self.content;
textV.editable = NO;
[self.bkView addSubview:textV]; [textV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(labTitle.mas_bottom);
make.centerX.equalTo(self.bkView);
make.width.equalTo(self.bkView).offset(-);
make.bottom.equalTo(self.bkView).offset(-);
}]; UIButton *closeBtn = [UIButton new];
[closeBtn setTitle:@"关闭" forState:UIControlStateNormal];
closeBtn.backgroundColor = [UIColor blueColor];
[self.bkView addSubview:closeBtn];
[closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(textV.mas_bottom);
make.centerX.equalTo(textV);
make.width.equalTo(self.bkView);
make.bottom.equalTo(self.bkView);
}]; [[closeBtn rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(__kindof UIControl * _Nullable x) {
[UIView animateWithDuration:animalDuration animations:^{
self.alphView.alpha = 0.0;
self.bkView.frame = CGRectMake(, kMainBoundsHeight, kMainBoundsWidth, );
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}]; [UIView animateWithDuration:animalDuration animations:^{
self.alphView.alpha = 1.0;
self.bkView.frame = CGRectMake(, kMainBoundsHeight-, kMainBoundsWidth, );
}];
} - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[UIView animateWithDuration:animalDuration animations:^{
self.alphView.alpha = 0.0;
self.bkView.frame = CGRectMake(, kMainBoundsHeight, kMainBoundsWidth, );
} completion:^(BOOL finished) {
[self removeFromSuperview];
}]; } @end

iOS - 毛玻璃动画效果的更多相关文章

  1. iOS各种动画效果

    ios各种动画效果 最普通动画: //开始动画 [UIView beginAnimations:nil context:nil];  //设定动画持续时间 [UIView setAnimationDu ...

  2. iOS的动画效果类型及实现方法

    实现iOS漂亮的动画效果主要有两种方法, 一种是UIView层面的, 一种是使用CATransition进行更低层次的控制, 第一种是UIView,UIView方式可能在低层也是使用CATransit ...

  3. iOS 转盘动画效果实现

    代码地址如下:http://www.demodashi.com/demo/11598.html 近期公司项目告一段落,闲来无事,看到山东中国移动客户端有个转盘动画挺酷的.于是试着实现一下,看似简单,可 ...

  4. iOS开动画效果之──实现 pushViewController 默认动画效果

    在开发中,视图切换会常常遇到,有时我们不是基于导航控制器的切换,但实际开发中,有时需要做成push效果,下面将如何实现push和pop 默认动画效果代码实例: 一.push默认动画效果 CATrans ...

  5. ios animation 动画效果实现

    1.过渡动画 CATransition CATransition *animation = [CATransition animation]; [animation setDuration:1.0]; ...

  6. iOS毛玻璃擦除效果

    思路:首先我的思路放两个imageView在Controller里把高清的图片放在下面,带有毛玻璃效果的图片放在上面. //在Controller的view上加一个手势代码如下(温馨提示,开启imae ...

  7. iOS简单动画效果:闪烁、移动、旋转、路径、组合

    #define kDegreesToRadian(x) (M_PI * (x) / 180.0) #define kRadianToDegrees(radian) (radian*180.0)/(M_ ...

  8. iOS火焰动画效果、图文混排框架、StackView效果、偏好设置、底部手势等源码

    iOS精选源码 高性能图文混排框架,构架顺滑的iOS应用. 使用OpenGLE覆盖阿尔法通道视频动画播放器视图. 可选最大日期截至当日日期的日期轮选器ChooseDatePicker 简单轻量的图片浏 ...

  9. iOS UIView动画效果 学习笔记

    //启动页动画 UIImageView *launchScreen = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds]; ...

随机推荐

  1. 阶段3-团队合作\项目-网络安全传输系统\sprint2-线程池技术优化

    之前问题的存在,之前只是用一个客户端在与服务器进行连接,当多个客户端进行连接的时候会连接不上处于等待状态,说明以前我们的服务器只能同时处理一个请求,故需要修改 服务器: 单发:初始化--等待客户端连接 ...

  2. 1.Windows入侵排查思路

    0x00 前言 当企业发生黑客入侵.系统崩溃或其它影响业务正常运行的安全事件时,急需第一时间进行处理,使企业的网络信息系统在最短时间内恢复正常工作,进一步查找入侵来源,还原入侵事故过程,同时给出解决方 ...

  3. JS使用replace替换字符串中的某段或某个字符

    函数的介绍参考:http://www.w3school.com.cn/jsref/jsref_replace.asp 下列代码将Hello World!中的World替换为Jim <html&g ...

  4. WPF的TextBox产生内存泄露的情况

    前段时间参与了一个WPF编写的项目,在该项目中有这样一个场景:在程序运行过程中需要动态地产生大量文本信息,并追加WPF界面上的一个TextBox的Text中进行显示.编写完之后,运行该项目的程序,发现 ...

  5. 解决Navicat 无法连接mysql8.0

    必须执行下面两个步骤,缺一不可. 一.        mysql8.0加密方式与mysql5几加密方式不同,需要先更改加密方式. 更改加密方式 ALTERUSER 'root'@'localhost' ...

  6. 【前端自动化】Gulp的使用(一):安装gulp

    作为一个.NET码农,在前端高速发展的时代,深深感觉自己那么点“前端”技术不够看,比如开发出来的js css等文件庞大,不便于管理,还记得以前的开发就是累加 html  css   jquery, 现 ...

  7. GVIM安装手记

    GVIM安装手记 1. 安装GIT及GVIM Downloa Git URL : https://gitforwindows.org/ Downloa GVim URL : https://www.v ...

  8. Linux基础学习(一)

    前言:这个学习笔记是为了督促自己能够更好的学习Linux的有关知识. 参考书目 鸟哥的linux私房菜 Chapter 1:入门建议 新手建议:重点 基础一定一定要学好 那么什么是基础呢? 先从Lin ...

  9. 【转载】【爬坑记录】hyperledger caliper 性能测试工具使用的一些问题记录

    原文: https://blog.csdn.net/raogeeg/article/details/82752613 安装方法详见:https://github.com/hyperledger/cal ...

  10. 洛谷P1066 2^k进制数

    P1066 2^k进制数 题目描述 设r是个2^k 进制数,并满足以下条件: (1)r至少是个2位的2^k 进制数. (2)作为2^k 进制数,除最后一位外,r的每一位严格小于它右边相邻的那一位. ( ...