美文网首页iOS开发你需要知道的
27.转场效果MZFormSheetPresentationCo

27.转场效果MZFormSheetPresentationCo

作者: cj2527 | 来源:发表于2017-08-18 11:53 被阅读233次

    网址: (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];
    

    相关文章

      网友评论

        本文标题:27.转场效果MZFormSheetPresentationCo

        本文链接:https://www.haomeiwen.com/subject/pmoorxtx.html