部分代码 InteractiveTransition 类继承NSObject:

- (instancetype)initWithPresentingController:(UITableViewController *)presentingVc presentedController:(UIViewController *)presentedVc {
self = [super init];
if (self) {
self.vc = presentedVc;
self.vc.transitioningDelegate =self;
self.presentingVc = presentingVc;
}
return self;
} - (void)new_scrollViewWillBeginDragging:(UIScrollView *)scrollView {
self.interactiveTransition = [[UIPercentDrivenInteractiveTransition alloc]init];
[self.presentingVc presentViewController:self.vc animated:YES completion:nil];
} - (void)new_scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat offsetY = fabs(scrollView.contentOffset.y); CGFloat screenH = [UIScreen mainScreen].bounds.size.height / 3.0;
progress = offsetY / screenH;
progress = progress-0.3;
if (progress > ) {
[self.interactiveTransition updateInteractiveTransition:progress];
} }
- (void)new_scrollViewWillEndDragging {
if (progress < 0.4) {
[self.interactiveTransition cancelInteractiveTransition];
}else {
[self.interactiveTransition finishInteractiveTransition];
}
self.interactiveTransition = nil;
} - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source { return self.animation;
} - (id<UIViewControllerInteractiveTransitioning>)interactionControllerForPresentation:(id<UIViewControllerAnimatedTransitioning>)animator { return self.interactiveTransition;
}

PresentAnimation 类继承NSObject 实现 UIViewControllerAnimatedTransitioning协议

- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext {
return 1.0;
} - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext { UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey];
UIView *containerView = [transitionContext containerView];
[containerView addSubview:toView]; toView.frame = CGRectMake(, containerView.bounds.size.height, containerView.bounds.size.width - , containerView.bounds.size.height - ); [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
toView.frame = containerView.bounds;
}completion:^(BOOL finished) {
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
}]; }

控制器:

- (InteractiveTransition *)interactive {
if (!_interactive) {
_interactive = [[InteractiveTransition alloc]initWithPresentingController:self presentedController:[[TwoViewController alloc]init]];
}
return _interactive;
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { [self.interactive new_scrollViewWillBeginDragging:scrollView];
} - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { [self.interactive new_scrollViewWillEndDragging];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { [self.interactive new_scrollViewDidScroll:scrollView];
}

完整代码:http://pan.baidu.com/s/1i3Uewip

上拉、下拉UITableView,交互式 模态弹出(自定义弹出动画)的更多相关文章

  1. [BS-23] AFN网络请求上拉/下拉刷新的细节问题总结

    上拉/下拉刷新的细节问题总结 1.如果导航栏有透明色,则也需要设置header自动改变透明度 self.tableView.mj_header.automaticallyChangeAlpha = Y ...

  2. Swiper 判断上滑下拉操作

    onTouchMove: function(swiper){ //手动滑动中触发//判断上滑下拉var i = mySwiper.translate;setTimeout(function() {va ...

  3. ios position:fixed 上滑下拉抖动

    ios position:fixed 上滑下拉抖动 最近呢遇到一个ios的兼容问题,界面是需要一个头底部的固定的效果,用的position:fixed定位布局,写完测试发现安卓手机正常的,按时ios上 ...

  4. 浅谈对MJRefresh(上)下拉刷新控件的理解

    MJRefresh GitHub地址:https://github.com/CoderMJLee/MJRefresh 利用业余时间研究了一下iOS的开发,发现OC特定的语法方式吸引了我,而且iOS开发 ...

  5. jsp页面上的下拉框案例(Struts2)

    <s:select></s:select>包含的属性有:list=""  :name=""  :value=""   ...

  6. 160823、ionic上拉/下拉更新数据

    <!DOCTYPE html> <html ng-app="myApp"> <head> <meta charset="UTF- ...

  7. js实现页面的上滑下拉功能

    这两天做项目,用到了上滑和下拉的功能,主要是通过监听touchmove,touchstart,touchend三个事件去判断页面上滑状态还是下拉状态. 同时加一个知识点:有时在监听时会报错,这个错是这 ...

  8. SDI在自定义的工具栏上添加下拉控件

    0.首先到自己的工具条上新建一个控件,并命名新ID 1.拷贝FlatComboBox.h和FlatComboBox.cpp到工程目录下 2.建立新类 class CTrackerToolBar : p ...

  9. 小程序 上啦下拉刷新window配置

    "enablePullDownRefresh": "true"   /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefres ...

  10. git过期后,如何将新建的项目push到码云上而且下拉成功

    1.在码云上创建一个项目: 2.打开STS(spring Tool Suite)   新建一个Maven(webapp)项目: 3.打开你的码云账号,把码云上的工程的URL复制: 4.重新在另一个目录 ...

随机推荐

  1. [Mugeda HTML5技术教程之17] 理解Mugeda访问统计结果

    1. 功能简介 Mugeda提供动画统计功能,使得动画制作者可以直观的了解动画的浏览情况,包括浏览量,参与度,以及观看者的分布情况. 目前统计功能主要展示动画内容和广告工程的统计数据.在动画被发布或导 ...

  2. css之自动换行-设计师零张

    自动换行问题,正常字符的换行是比较合理的,而连续的数字和英文字符常常将容器撑大,挺让人头疼,下面介绍的是CSS如何实现换行的方法 对于div,p等块级元素 正常文字的换行(亚洲文字和非亚洲文字)元素拥 ...

  3. 深入理解Azure自动扩展集VMSS(2)

    VMSS中Auto Scale基本原理及诊断 在前面的介绍中,我们看到通过定义规则可以实现虚拟机扩展集的auto scale,那么在后台执行上VMSS的扩展依赖于哪些组件,出现问题(比如自动扩展没有发 ...

  4. POJ 3675 Telescope

    题意:给定一个不自交的多边形,要求和圆心在原点的圆的面积交. 思路:同POJ2986,是加强版 代码: #include<algorithm> #include<cstdio> ...

  5. HDU 2457 DNA repair (AC自动机+DP)

    题意:给N个串,一个大串,要求在最小的改变代价下,得到一个不含上述n个串的大串. 思路:dp,f[i][j]代表大串中第i位,AC自动机上第j位的最小代价. #include<algorithm ...

  6. Keil C51里关于堆栈指针的处理

    Keil C是非常优秀的C51编译器,可能是最好的C51编译器,提供各种优化模式,对变量的优化和地址安排做得非常好.这是用C语言写代码的好处之一,如果用汇编写,得费一大番功夫给各个变量安排内存物理地址 ...

  7. 非索引列上的统计 <第二篇>

    非索引列上的统计 有时候,可能在连接或过滤条件中的列上没有索引.即使对这种非索引列,如果查询优化器知道这些列的数据分布(统计),它也很可能做出最佳的选择. 除了索引上的统计,SQL Server可以在 ...

  8. Auto Install Workflow Manager 1.0

    Write-Host "- Begining Download Service Bus..." Start /W "c:\Program Files\Microsoft\ ...

  9. VS代码生成工具ReSharper使用手册:配置快捷键

    原文 http://www.cnblogs.com/PHPIDE/archive/2013/05/16/3081783.html VS代码生成工具ReSharper提供了丰富的快捷键,可以极大地提高你 ...

  10. Android,监控ContentProvider的数据改变

    有时候应用中需要监听ContentProvider的改变并提供响应,这时候就要利用ContentObserver类了 不管是ContentProvider中实现的,insert,delete,upda ...