1

がありAlertView、アラート ビューとしてimageViewフリップ アニメーション ( UIViewAnimationTransitionFlipFromLeft/ Right)で画像を表示する必要があります。subview

私は次の方法を使用しています

- (void) setAnimationFlip:(UIAlertView*)alertView {

    UIView *containerView = [[UIView alloc]initWithFrame:CGRectMake(20, 40, 150, 150)];
    UIImageView *mainView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"scene1.jpg"]];
    UIImageView *flipToView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"scene2.jpg"]];

    mainView.frame = CGRectMake(20, 40, 200, 210);
    flipToView.frame = CGRectMake(20, 40, 200, 210);

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:2.0];

    [UIView setAnimationTransition:([mainView superview] ?
                                    UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
                           forView:containerView cache:YES];
    if ([flipToView superview])
    {
        [flipToView removeFromSuperview];
        [containerView addSubview:mainView];

    }
    else
    {
        [mainView removeFromSuperview];
        [containerView addSubview:flipToView];
    }

    [self.alrtViewPreview addSubview:containerView];
    [self.alrtViewPreview show];

    [UIView commitAnimations];

    //[containerView release];
    //[mainView release];
    //[flipToView release];

}

そして次のように呼び出します...

    switch (iEffect) {
            case 1:

                [self setAnimationFlip:alrtViewPreview];
                break;
    }

しかし、それは私にとってはうまくいきません。誰かが私を助けることができますか?

4

1 に答える 1

0
-(IBAction)btnClick:(UIButton*)sender {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:sender cache:YES]; 
    [UIView setAnimationDelegate:self]; 
    [sender setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",self.tileImage]] forState:UIControlStateNormal];
        [sender setTitle:self.tileText forState:UIControlStateNormal];

    [UIView commitAnimations];

}
于 2013-01-24T11:07:52.030 に答える