我有一个 iphone 应用程序,我在其中添加了一个视图控制器视图,其中包含一个类似于从左翻转的动画。我正在使用导航栏按钮项进行操作。单击它时,我正在将视图控制器视图添加到我的 rootview 中。并更改按钮 amd该操作我正在删除该视图并添加上一个按钮。但是 pbm 我需要在该视图内的按钮操作中删除该信息视图。这是我的翻转动画代码。
- (void)backPressed1
{
InfoViewController *infoviewcontroller = [[InfoViewController alloc] initWithNibName:@"InfoViewController" bundle:nil];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.95];
//[UIView beginAnimations:nil context:NULL];
//[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
//CGRect frame=CGRectMake(0,0,320,480);
[rootview removeFromSuperview];
//[infoviewcontroller.view setFrame:frame];
//selfhelpscoresAppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
[infoviewcontroller viewWillAppear:YES];
[self.view addSubview:infoviewcontroller.view];
[UIView commitAnimations];
UIImage *buttonImage = [UIImage imageNamed:@"information_btn.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, 42, 32);
[button addTarget:self action:@selector(backpressed) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.rightBarButtonItem = customBarItem;
//UILabel *label =[[[UILabel alloc]init]autorelease];
self.navigationItem.title=@"Tutorial";
//label.text = @"";
//self.navigationController.title = @"";
[customBarItem release];
}
-(IBAction)backpressed
{
InfoViewController *infoviewcontroller = [[InfoViewController alloc] initWithNibName:@"InfoViewController" bundle:nil];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.95];
//[UIView beginAnimations:nil context:NULL];
//DailypercentageViewController *pieChart = [[DailypercentageViewController alloc] initWithNibName:@"DailypercentageViewController" bundle:nil];
//[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
//CGRect frame=CGRectMake(0,0,320,370);
[infoviewcontroller.view removeFromSuperview];
[self.view addSubview:rootview];
[UIView commitAnimations];
//[rearView setFrame:frame];
//[pieChart viewDidAppear:YES];
UIImage *buttonImage1 = [UIImage imageNamed:@"information_btn.png"];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
[button1 setImage:buttonImage1 forState:UIControlStateNormal];
button1.frame = CGRectMake(0, 0, 42, 32);
[button1 addTarget:self action:@selector(backPressed1) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *customBarItem1 = [[UIBarButtonItem alloc] initWithCustomView:button1];
self.navigationItem.rightBarButtonItem = customBarItem1;
[customBarItem1 release];
//UILabel *label1 =[[[UILabel alloc]init]autorelease];
self.navigationItem.title=@"";
//label1.text = @"Home";
//self.title= @"Home";
}
`我的问题是如何删除此信息视图并从信息视图的按钮操作中返回根视图?