网址: (https://github.com/m1entus/MZFormSheetPresentationController)
场景应用:两个场景的转场,例如首页点击登录按钮,屏幕中间弹出登录的vc
LoginViewController *loginVC = [LoginViewController create];
MZFormSheetPresentationViewController *formSheetController = [[MZFormSheetPresentationViewController alloc] initWithContentViewController:loginVC];
[formSheetController setContentViewControllerTransitionStyle:MZFormSheetPresentationTransitionStyleBounce];
[MZFormSheetPresentationController appearance].shouldCenterHorizontally = YES;
[MZFormSheetPresentationController appearance].shouldCenterVertically = YES;
[MZFormSheetPresentationController appearance].movementActionWhenKeyboardAppears = MZFormSheetActionWhenKeyboardAppearsCenterVertically;
formSheetController.interactivePanGestureDismissalDirection = MZFormSheetPanGestureDismissDirectionNone;
[viewController presentViewController:formSheetController animated:YES completion:nil];
MZFormSheetPresentationController
provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup controller size
and feel form sheet.
它提供了一种接近原生iOS的模态窗口,添加了对iPhone的支持,另外可以设置大小以及触摸。
MZFormSheetPresentationController
also has a number of predefined transitions so you can customize whether the modal form slides in, fades in, bounces in or you can create your own custom transition.
它也有很多预定义的转场效果,你可以定制slides in,fades in, bounces in等效果或者你可以创建自己的自定义转场。
There are also a number of properties for customizing the exact look and position of the form.
对于定制准确的样子和窗口的位置,它也有很多属性。
It support also pan gesture dismissing.它也支持手势消失。
This project is continuation of MZFormSheetController
which allow you to make form sheet when deployment target is set to >iOS5 but use some tricky UIWindow hacks.
Here are a couple of images showing MZFormSheetPresentationController
in action:
There are two example projects, one is for Objective-C
UINavigationController *navigationController = [self.storyboard instantiateViewControllerWithIdentifier:@"formSheetController"];
MZFormSheetPresentationViewController *formSheetController = [[MZFormSheetPresentationViewController alloc] initWithContentViewController:navigationController];
formSheetController.presentationController.contentViewSize = CGSizeMake(250, 250); // or pass in UILayoutFittingCompressedSize to size automatically with auto-layout
[self presentViewController:formSheetController animated:YES completion:nil];