MSTDropDownPresentationController 0.2.2

MSTDropDownPresentationController 0.2.2

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布上次发布2015年6月

Masahiko Tsujita 维护。



  • Masahiko Tsujita

概览

类似于 Tweetbot 3 的时间轴/列表切换器的下拉显示控制器。

需求

iOS 8 & iOS SDK 8.0 及更高版本。

安装

MSTDropDownPresentationController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile。

pod "MSTDropDownPresentationController"

用法

使用 UIViewControllerTransitioningDelegate

首先,采用 UIViewControllerTransitioningDelegate

- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source {
    return [[MSTDropDownPresentationController alloc] initWithPresentedViewController:presented presentingViewController:presenting];
}

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
    return [[MSTDropDownAnimationController alloc] init];
}

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
    return [[MSTDropDownAnimationController alloc] init];
}

其次,以自定义显示方式展示视图控制器

viewController.modalPresentationStyle = UIModalPresentationCustom;
viewController.transitioningDelegate = self;
[self presentViewController:viewController animated:YES completion:NULL];

或者,您可以如下获取简单的代理对象

viewController.transitioningDelegate = self.mst_dropDownTransitioningDelegate;

或者,您还可以使用自定义Storyboard Segue类

选择“自定义”转场,并将“MSTDropDownStoryboardSegue”指定为转场类。

许可

MSTDropDownPresentationController 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。