ZFDragableModalTransition 0.6

ZFDragableModalTransition 0.6

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年12月

zoonref 维护。



  • Amornchai Kanokpullwad

使用方法

- (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;

    // if you modal cover all behind view controller, use UIModalPresentationFullScreen
    detailViewController.modalPresentationStyle = UIModalPresentationCustom;
}

UIScrollView

如果你的模态中包含 UIScrollView,并且想要通过拖动来关闭模态,你需要将 UIScrollView 设置为 ZFModalTransitionAnimator 实例。

[self.animator setContentScrollView:detailViewController.scrollview];

方向

你可以设置模态呈现的方向。(默认为 ZFModalTransitonDirectionBottom)

self.animator.direction = ZFModalTransitonDirectionBottom;

提示:现在你只能使用 ZFModalTransitonDirectionBottom 设置内容 UIScrollView。

需求

  • iOS >= 7.1
  • ARC

安装

常见问题解答

如何只显示视图的一部分模态?

当前的 ViewController 的视图仍然在模态背后可见,因此你只需将背景视图设置为透明颜色。

作者

Amornchai Kanokpullwad,@zoonref

许可证

ZFDragableModalTransition 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。