我正在調用turnView方法,它必須得到不可見的menuView(當前)並可能顯示adjustView。當方法被調用時,它被執行時沒有錯誤,但不切換視圖,menuView保持不變,並且它返回到以下的方法調用行。如何解決它?從menuView感謝切換視圖時視圖不會消失
電話:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
aboutTabController * myObject = [[aboutTabController alloc] init];
if (indexPath.section == 1) {
switch (indexPath.row) {
case 0:
[myObject turnView];
break;
case 1:
//
break;
default:
break;}
}
}
方法的控制器來實現,menuController是爲menuView類中定義:
- (void) turnView
{
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
if (self.adjustController == nil)
{
adjustView *aController = [[adjustView alloc] initWithNibName:@"adjustView" bundle:nil];
self.adjustController = aController;
[aController release];
}
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
[self.menuController viewWillDisappear:YES];
[self.adjustController viewWillAppear:YES];
[self.menuController.view removeFromSuperview];
[self.view insertSubview:adjustController.view atIndex:0];
[self.menuController viewDidDisappear:YES];
[self.adjustController viewDidAppear:YES];
[UIView commitAnimations];
}
工作,更容易,awsome :) – Ruth85