当视图改变时我需要爆炸效果,即当我移动到下一个视图时爆炸动画。当我点击仪表板中的图标
时,我在Facebook应用程序中找到了这种类型的动画请帮帮我
答案 0 :(得分:1)
hai我完成了爆炸视图这是我的代码感谢您的帮助
//点击事件查看爆炸
-(IBAction) buttonPressed: (id) sender{
UIButton *buttonPressed = (UIButton *)sender;
NSLog(@"buttonTag %d",buttonPressed.tag);
@try {
switch (buttonPressed.tag) {
NSLog(@"Pugal");
case 0:
viewController=news;
break;
case 1:
viewController=videoWeb;
break;
case 2:
viewController=photo;
break;
case 3:
viewController=events;
break;
case 4:
viewController=mobileWeb;
break;
default:
break;
}
}
[self performSelector:@selector(animateTransition:) withObject:[NSNumber numberWithFloat: TIME_FOR_EXPANDING]];
}
//动画过渡
-(void)animateTransition:(NSNumber *)duration {
self.view.userInteractionEnabled=NO;
[[self view] addSubview:viewController.view];
if ((viewController.view.hidden==false) && ([duration floatValue]==TIME_FOR_EXPANDING)) {
viewController.view.frame=[[UIScreen mainScreen] bounds];
viewController.view.transform=CGAffineTransformMakeScale(SCALED_DOWN_AMOUNT, SCALED_DOWN_AMOUNT);
}
viewController.view.hidden=false;
if ([duration floatValue]==TIME_FOR_SHRINKING) {
[UIView beginAnimations:@"animationShrink" context:NULL];
[UIView setAnimationDuration:[duration floatValue]];
viewController.view.transform=CGAffineTransformMakeScale(SCALED_DOWN_AMOUNT, SCALED_DOWN_AMOUNT);
}
else {
[UIView beginAnimations:@"animationExpand" context:NULL];
[UIView setAnimationDuration:[duration floatValue]];
viewController.view.transform=CGAffineTransformMakeScale(1, 1);
}
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView commitAnimations];
}
//动画停止
-(void)animationDidStop:(NSString *)animationID finished:(BOOL)finished context:(void *)context{
self.view.userInteractionEnabled=YES;
if ([animationID isEqualToString:@"animationExpand"]) {
UINavigationController *navig = [[[UINavigationController alloc] initWithRootViewController:viewController] autorelease];
[self presentModalViewController:navig animated:NO];
}
else {
viewController.view.hidden=true;
}
}
按照我的要求工作谢谢
答案 1 :(得分:0)
动作...拍摄图像查看将其作为子视图添加到视图中,加载一系列爆炸图像(或任何你想要的东西)启动它动画,当动画从代理完成时将其从superview中删除