How do I animate/rotate a UIView 90 degress from its upper right corner?

前端 未结 3 1362
清歌不尽
清歌不尽 2021-02-02 04:01

I\'ve been searching for hours trying to find a way to animate/rotate a UIView 90 degrees from the upper right corner.

The effect should almost work like a swinging door

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-02 04:11

    You should try this code:

    -(void)doRotationView{
    [UIView beginAnimations:@"flipping view" context:nil];  
        [UIView setAnimationDuration:1];    
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];   
        [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft    
                               forView:self cache:YES];
        if (flagFront == 1) {
            flagFront =0;
            [self.viewSecond setHidden:NO];
            [self.viewFirst setHidden:YES];
        }
        else{
            flagFront =1;
            [self.viewSecond setHidden:YES];
            [self.viewFirst setHidden:NO];        
        }
        [UIView commitAnimations];
    

    }

提交回复
热议问题