iPhone Curl Left and Curl Right transitions

后端 未结 5 1331
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 03:59

I am looking for a way to do a UIViewAnimationTransitionCurlUp or UIViewAnimationTransitionCurlDown transition on the iPhone but instead of top to

5条回答
  •  时光说笑
    2020-12-01 04:44

    It's possible to do curls in any of the four directions by using a container view. Set the container view's transformation to the angle you want and then do the curl by adding your view to the container view, not your app's main view which does not have a transformed frame:

    NSView* parent = viewController.view; // the main view
    NSView* containerView = [[[UIView alloc] initWithFrame:parent.bounds] autorelease];
    containerView.transform = CGAffineTransformMakeRotation();
    [parent addSubview:containerView]; 
    
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:containerView cache:YES];
    [containerView addSubview:view];
    [UIView commitAnimations];
    

提交回复
热议问题