push自定义动画
//
// ViewController.m
// ViewControllerAnimation
//
// Created by mac on 15/5/26.
// Copyright (c) 2015年 BSY. All rights reserved.
//
#import "ViewController.h"
#import "TwoViewController.h"
@interface
ViewController ()<
UINavigationControllerDelegate
,
UIViewControllerTransitioningDelegate
>
@property
(
nonatomic
,strong)TwoViewController*two;
@property
(
nonatomic
,strong)
UIViewController
*currentViewController;;
@end
@implementation
ViewController
- (
void
)viewDidLoad {
[
super
viewDidLoad];
self
.title = @
"第一页"
;
self
.view.backgroundColor = [
UIColor
grayColor];
self
.Animator = [[BSYAnimator alloc]init];
self
.TransitionAnimator = [[BSYTransitionAnimator alloc]init];
UIButton
*button = [
UIButton
buttonWithType:
UIButtonTypeCustom
];
[button setFrame:CGRectMake(100, 100, 100, 100)];
[button setTitle:@
"Push"
forState:
UIControlStateNormal
];
[button setTitleColor:[
UIColor
blackColor] forState:
UIControlStateNormal
];
[
self
.view addSubview:button];
[button addTarget:
self
action:
@selector
(buttonClick) forControlEvents:
UIControlEventTouchUpInside
];
TwoViewController *two = [[TwoViewController alloc]init];
self
.two = two;
self
.navigationController.delegate =
self
;
two.transitioningDelegate =
self
;
two.modalPresentationStyle =
UIModalPresentationCustom
;
[
self
addChildViewController:two];
self
.currentViewController = two;
}
-(
void
)buttonClick
{
[
self
.navigationController pushViewController:
self
.two animated:
YES
];
}
#pragma mark - UINavigationControllerDelegate iOS7新增的2个方法
// 动画特效
- (
id
<
UIViewControllerAnimatedTransitioning
>) navigationController:(
UINavigationController
*)navigationController animationControllerForOperation:(
UINavigationControllerOperation
)operation fromViewController:(
UIViewController
*)fromVC toViewController:(
UIViewController
*)toVC
{
if
(operation ==
UINavigationControllerOperationPush
) {
return
self
.Animator;
}
else
{
return
nil
;
}
}
#pragma mark - Transitioning Delegate (Modal)
-(
id
<
UIViewControllerAnimatedTransitioning
>)animationControllerForPresentedController:(
UIViewController
*)presented presentingController:(
UIViewController
*)presenting sourceController:(
UIViewController
*)source
{
self
.TransitionAnimator.animationType = AnimationTypePresent;
return
self
.TransitionAnimator;
}
-(
id
<
UIViewControllerAnimatedTransitioning
>)animationControllerForDismissedController:(
UIViewController
*)dismissed
{
self
.TransitionAnimator.animationType = AnimationTypeDismiss;
return
self
.TransitionAnimator;
}
@end
push自定义动画的更多相关文章
- iOS 8自定义动画转场上手指南
原文:http://www.cocoachina.com/ios/20150126/11011.html iOS 5发布的时候,苹果针对应用程序界面的设计,提出了一种全新的,革命性的方法—Storyb ...
- android 自定义动画
android自定义动画注意是继承Animation,重写里面的initialize和applyTransformation,在initialize方法做一些初始化的工作,在applyTransfor ...
- Android开发学习之路-RecyclerView的Item自定义动画及DefaultItemAnimator源码分析
这是关于RecyclerView的第二篇,说的是如何自定义Item动画,但是请注意,本文不包含动画的具体实现方法,只是告诉大家如何去自定义动画,如何去参考源代码. 我们知道,RecyclerView默 ...
- 深入学习jQuery自定义动画
× 目录 [1]属性对象 [2]可选参数 [3]选项参数 前面的话 很多情况下,前面介绍的jQuery动画的简单效果无法满足用户的各种需求,那么就需要对动画有更多的限制,需要采取一些高级的自定义动画来 ...
- 自定义动画css属性
自定义动画: 1.animation-name(自定义动画名称) 元素所应用的动画名称,必须与@keyframes使用,名称由@keyframes定义. keyframes(动画关键帧):以@keyf ...
- [UE4]CustomAnimationBlueprintNode 自定义动画蓝图节点
目的:在AnimationBlueprint中使用自定义动画控制节点. 主要过程: 1. 引用相关模块.在Client.Build.cs文件中,PublicDependencyModuleN ...
- CSS3初学篇章_6(自定义动画)
自定义动画 由于有一部分低版本的浏览器并不支持的问题,所以这个样式要多做兼容,各大浏览器兼容前缀如下: 前缀 浏览器 -webkit chrome和safari -moz firefox - ...
- Popwindow自定义动画(nexus5不支持暂未解决)
遇到一个问题,先记录一下 PopWindow自定义动画 import android.app.Activity; import android.graphics.drawable.BitmapDraw ...
- Android开发UI之自定义动画
自定义动画,需要新建一个类,继承Animation类. 重写applyTransformation()方法和initialize()方法. applyTransformation(float inte ...
随机推荐
- Hive on Spark和Spark sql on Hive,你能分的清楚么
摘要:结构上Hive On Spark和SparkSQL都是一个翻译层,把一个SQL翻译成分布式可执行的Spark程序. 本文分享自华为云社区<Hive on Spark和Spark sql o ...
- hive 之 常用基本操作
show databases; -- 查看所有数据库 use 数据库; -- 进入某个数据库 select current_database(); -- 查看当前使用的数据库 show tables; ...
- sql server - 修改表名、列名
EXEC sp_rename '旧表名', '新表名'; 例子 EXEC sp_rename 'saveremark', 'drawingLooking'; EXEC sp_rename '表名.[列 ...
- xftp 6 的 使用
1.前言 xftp是个向云服务器linux系统传输文件的软件,装载在window系统 简单易用 2.下载 官方下载地址:https://www.netsarang.com/zh/xftp-downlo ...
- 几张图解释明白 Kubernetes Ingress
来源:K8s技术圈 作者:阳明 Kubernetes Ingress 只是 Kubernetes 中的一个普通资源对象,需要一个对应的 Ingress 控制器来解析 Ingress 的规则,暴露服务到 ...
- MINItest软件架构总结
MINItest软件架构总结 ----helloWen MINItest软件架构总结1. Problem Description2. Analysis3. Solution3.1. 通过读取设备信息来 ...
- NPOI Excel导入Invalid header signature
excel是从网页下载或者其他第三方软件导出的解决方法:使用excel打开,另存为2003版的excel,再导入就好了或者保存为 xlsx
- 带你读AI论文丨RAID2020 Cyber Threat Intelligence Modeling GCN
摘要:本文提出了基于异构信息网络(HIN, Heterogeneous Information Network)的网络威胁情报框架--HINTI,旨在建模异构IOCs之间的相互依赖关系,以量化其相关性 ...
- csapp lab2 拆炸弹
1. 实验内容 包含一个二进制应用bomb,需要根据该应用猜测程序的运行过程.程序主体包含了六个函数phase_1到phase_6,每个函数会根据用户的输入做出反应,当输入符合要求时,会炸弹拆解成功, ...
- 【刷题-LeetCode】153 Find Minimum in Rotated Sorted Array
Find Minimum in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some p ...