UIViewController half screen “drawer slide” animation

后端 未结 3 742
余生分开走
余生分开走 2021-02-15 18:57

I am trying to have a UIViewController that appears with a \"slide\" animation from the right. Not like a Push segue, not like the Facebook app. I want the new View

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-15 19:20

    Using the answer given by Albara, I was able to also create a segue with the same animation. The custom segue is as follows:

    - (void)perform
    {
        UIViewController *src = (UIViewController *)self.sourceViewController;
        UIViewController *dst = (UIViewController *)self.destinationViewController;
    
        [dst.view setFrame:CGRectMake(380, 0, dst.view.frame.size.width, dst.view.frame.size.height)];
    
        [src addChildViewController:dst];
        [src.view addSubview:dst.view];
        [dst didMoveToParentViewController:src];
    
        [UIView animateWithDuration:0.5 animations:^{
            [dst.view setFrame:CGRectMake(300, 0, src.view.frame.size.width, src.view.frame.size.height)];
        }];
    
    }
    

    Just a matter of renaming, really.

提交回复
热议问题