[翻译] ZFDragableModalTransition

本文介绍了如何利用ZFDragableModalTransition库在iOS应用中实现具有拖拽功能的Modal控制器,包括配置参数、关键代码示例及使用注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

 

转载于:https://www.cnblogs.com/YouXianMing/p/4264734.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值