测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可 | MIT |
发布上次发布 | 2015年6月 |
由 Masahiko Tsujita 维护。
类似于 Tweetbot 3 的时间轴/列表切换器的下拉显示控制器。
iOS 8 & iOS SDK 8.0 及更高版本。
MSTDropDownPresentationController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile。
pod "MSTDropDownPresentationController"
首先,采用 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;
选择“自定义”转场,并将“MSTDropDownStoryboardSegue”指定为转场类。
MSTDropDownPresentationController 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。