我的視圖控制器上使用UITabBarController
即launchviewcontroller
其含有上loadview
如下代碼:如何刪除背景視圖
- (void)loadView
{
viewControllers=[[NSMutableArray alloc]initWithCapacity:2];
tabBarController=[[UITabBarController alloc]init];
MyProfileViewController *view1=[[MyProfileViewController alloc]init];
localNavigationController=[[UINavigationController alloc]initWithRootViewController:view1];
localNavigationController.navigationBar.alpha=1.0;
// localNavigationController.navigationBar.tintColor=[UIColor colorWithRed:0.65 green:0.84 blue:0.88 alpha:1];
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
// localNavigationController.navigationBar.
[viewControllers addObject:localNavigationController];
[view1 release];
[localNavigationController release];
localNavigationController=nil;
TodaysPicksViewController *view2=[[TodaysPicksViewController alloc]initWithLeagueType:@"CFL Football"];
localNavigationController=[[UINavigationController alloc]initWithRootViewController:view2];
localNavigationController.navigationBar.alpha=1.0;
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
[viewControllers addObject:localNavigationController];
[view2 release];
[localNavigationController release];
localNavigationController=nil;
Rules_PoliciesViewController *view3=[[Rules_PoliciesViewController alloc]init];
localNavigationController=[[UINavigationController alloc]initWithRootViewController:view3];
localNavigationController.navigationBar.alpha=1.0;
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
[viewControllers addObject:localNavigationController];
[view3 release];
[localNavigationController release];
localNavigationController=nil;
LogoutViewController *view4=[[LogoutViewController alloc]init];
localNavigationController=[[UINavigationController alloc]initWithRootViewController:view4];
localNavigationController.navigationBar.alpha=1.0;
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
[viewControllers addObject:localNavigationController];
[view4 release];
[localNavigationController release];
localNavigationController=nil;
appDel=[[UIApplication sharedApplication]delegate];
tabBarController.viewControllers=viewControllers;
[appDel.window addSubview:tabBarController.view];
[viewControllers release];
}
現在,作爲用戶進行到第四突出部從應用程序我註銷設置了按鈕登錄再次重定向由上按鈕點擊添加代碼作爲登錄視圖:
-(void)ClickOnLogin
{
LoginViewController *LoginViewOb=[[LoginViewController alloc]init];
LoginViewOb.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:LoginViewOb animated:YES];
[LoginViewOb release];
}
但作爲登錄視圖是負載ed先前的視圖仍然位於登錄視圖的後面。我怎樣才能從後臺刪除這個視圖。
你應該禁用後退按鈕上登錄視圖 – Baddu
禁用後退按鈕(HTTP [我如何從一個UINavigationController彈出一個視圖和一個操作與另一個替換嗎?] //stackoverflow.com/q/410471/1041847) – Alexander
在appdelegate你有加載每次登錄頁面,然後一個人的用戶登錄然後你可以加載標籤欄 – Anjaneyulu