Snapchat-like swipe navigation between views in Xcode 6 and Swift)

前端 未结 7 621
清酒与你
清酒与你 2021-01-30 11:47

I\'ve been trying to implement swipe navigation between View Controllers in my app using the Swipe Gesture Recognizer and embeded Navigation Controller, but it doesn\'t look eve

相关标签:
7条回答
  • 2021-01-30 12:40

    You can try using CATransition to create the swiping animation. Here is an example of how you can swipe from one view to another:

        UIView *parentView = [self.view superview];
    
    CATransition *animation = [CATransition animation];
    [animation setDuration:0.25];
    [animation setType:kCATransitionPush];
    [animation setSubtype:kCATransitionFromLeft];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    
    [parentView addSubview:yourSecondViewController.view];
    [self.view removeFromSuperview];
    
    [[theParentView layer] addAnimation:animation forKey:@"showSecondViewController"];
    

    I found some of that code here:How can I implement a swiping/sliding animation between views?

    0 讨论(0)
提交回复
热议问题