是否可以在单个视图中的iOS子视图之间移动而无需返回视图?如果是这样,怎么样?代码示例welcome。
我现在如何做,但这需要返回“主页”视图: 在myFile.m
中// Define the other views
DF_Results *df_Results;
CR_FiringRange *cr_FiringRange;
CR_AssetLoader *cr_AssetLoader;
DB_GeneralData *db_GeneralData;
DB_ArmorData *db_ArmorData;
DB_WeaponsData *db_WeaponsData;
@synthesize ScreenButton01;
@synthesize ScreenButton02;
@synthesize ScreenButton03;
@synthesize ScreenButton04;
@synthesize ScreenButton05;
@synthesize ScreenButton06;
@synthesize ScreenButton07;
.
.
.
-(IBAction) ScreenButton02Clicked:(id) sender {
df_Results = [[DF_Results alloc]
initWithNibName:@"DF_Results"
bundle:nil];
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
[self.view addSubview:df_Results.view];
[UIView commitAnimations];
}
在DF_Results中返回我们点击另一个按钮但我希望能够直接跳到另一个子视图:
-(IBAction) ResultsScreenButton01Clicked:(id) sender {
[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view.superview cache:YES];
[self.view removeFromSuperview];
[UIView commitAnimations];
}
答案 0 :(得分:0)
在iOS 4.0中,UIView有许多基于块的动画过渡任务,根据文档推荐的方法。例如。这个可能很有用:
(void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion
有关详细信息,请参阅UIView文档。