[翻译] ZFDragableModalTransition

简介:

ZFDragableModalTransition

Usage

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    TaskDetailViewController *detailViewController = segue.destinationViewController;
    detailViewController.task = sender;

    // create animator object with instance of modal view controller
    // we need to keep it in property with strong reference so it will not get release self.animator = [[ZFModalTransitionAnimator alloc] initWithModalViewController:detailViewController]; self.animator.dragable = YES; self.animator.direction = ZFModalTransitonDirectionBottom; [self.animator setContentScrollView:detailViewController.scrollview]; // set transition delegate of modal view controller to our object detailViewController.transitioningDelegate = self.animator; detailViewController.modalPresentationStyle = UIModalPresentationCustom; }

ScrollView

If you have scrollview in the modal and you want to dismiss modal by drag it, you need to set scrollview to ZFModalTransitionAnimator instance.

如果你在modal中有scrollview,而且你想通过拖拽来让控制器消失,你需要将这个scrollview设置成ZFModalTransitionAnimator的实例变量.

[self.animator setContentScrollView:detailViewController.scrollview];

Direction

You can set that which direction will our modal present. (default is ZFModalTransitonDirectionBottom)

你可以设置这个动画从哪个方向上来呈现.(默认是从底部呈现)

self.animator.direction = ZFModalTransitonDirectionBottom;

P.S. Now you can set content scrollview only with ZFModalTransitonDirectionBottom

P.S. 现在,通过以上设置后,动画想过将会从底部开始呈现.

Requirements

  • iOS >= 7.0 (tested on ios8 beta)
  • ARC

Installation

ZFDragableModalTransition is available through CocoaPods. To install it, simply add the following line to your Podfile:

ZFDragableModalTransition可以通过CocoaPods来安装.你只需要写如下的一段话就可以安装了:

pod "ZFDragableModalTransition"

Author

Amornchai Kanokpullwad, amornchai.zoon@gmail.com

License

ZFDragableModalTransition is available under the MIT license. See the LICENSE file for more info.

目录
相关文章
|
存储 自然语言处理 前端开发
从零写一个Recoil(翻译)
Rewriting Recoil from scratchrecoil是facebook编写的一个库,它之所以诞生是因为人体工程学、context的性能问题和useState。这是一个非常聪明的库,几乎每个人都会找到它的用途——如果你想了解更多,请查看这段解释视频。刚开始我被图论和recoil惊到了,但渐渐的理解后,感觉也没那么特别了。也许我也可以实现一个类似的东西。我自己实现的版本和recoil
198 0
从零写一个Recoil(翻译)
|
缓存 API iOS开发
|
网络架构 iOS开发 Perl