我有一个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;
}
但这对我不起作用,任何人都可以帮助我吗?