在 App Delegate Method 中,在 Navigation Controller 中添加 MAinView,然后添加到窗口:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
MainView *objMV = [[[MainView alloc]init] autorelease];
UINavigationController *mainNavController = [[UINavigationController alloc]initWithRootViewController:m_objMV];
[self.window addSubview:mainNavController.view];
[self.window makeKeyAndVisible];
return YES;
}
现在按钮的单击事件出现在 MainView 中,其方法如下:
-(IBAction)yourBtnAction:(id)sender
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.window cache:NO];
[UIView commitAnimations];
[mainNavController.view removeFromSuperview];
[m_mainNavController release];
// Your tab bar controller instance ie tabBarController
[self.window addSubview:tabBarController];
[self.window makeKeyAndVisible];
}