2013-07-10 62 views
0

我的視圖控制器上使用UITabBarControllerlaunchviewcontroller其含有上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先前的視圖仍然位於登錄視圖的後面。我怎樣才能從後臺刪除這個視圖。

+0

你應該禁用後退按鈕上登錄視圖 – Baddu

+0

禁用後退按鈕(HTTP [我如何從一個UINavigationController彈出一個視圖和一個操作與另一個替換嗎?] //stackoverflow.com/q/410471/1041847) – Alexander

+0

在appdelegate你有加載每次登錄頁面,然後一個人的用戶登錄然後你可以加載標籤欄 – Anjaneyulu

回答

0

你應該登錄查看

- (void)viewWillAppear:(BOOL)animated 
{ 
    self.navigationItem.leftBarButtonItem=nil; 
    self.navigationItem.hidesBackButton=YES; 
    [super viewWillAppear:animated]; 

} 
+0

沒有它沒有工作 – Priyanka

+0

我的想法是正確的,後退按鈕困擾着你嗎? – Baddu

+0

no.i已創建了一個用於註銷的視圖控制器,它顯示標籤,顯示您已成功註銷並單擊登錄按鈕以再次登錄 – Priyanka