2013-02-19 50 views
0

我在這裏遇到了一個問題,我正在試圖解決過去三天。當我運行我的iphone應用程序,它顯示此屏幕Login按鈕單擊無法第二次工作

一切工作正常,即如果我點擊「使用電子郵件登錄」按鈕它的工作。

當我點擊「登錄與Facebook」它顯示該屏幕Menu

但一旦我點擊「註銷」按鈕,將顯示該屏幕 Login after logout無標題和「通過電子郵件日誌在」沒有按」工作。

有什麼問題?後面註銷按鈕

代碼:

LoginViewController *LoginviewController = [[LoginViewController alloc]             initWithNibName:@"LoginViewController" bundle:nil]; 

[self presentViewController:LoginviewController animated:YES completion:nil]; 

退出按鈕駐留在的UITabBarController(編程創建)。這是視圖控制器的屏幕截圖,在我是無法第二次轉型 enter image description here

+0

無需在註銷按鈕上創建新實例。你可以把上一頁的實例取消。 – parilogic 2013-02-19 07:39:42

+1

try [self popViewController animated:YES]; – BhushanVU 2013-02-19 07:40:18

+3

將其推送到navigationcontroller而不是呈現爲模態視圖[self。navigationController pushViewController:LoginviewController animated:YES]; – superGokuN 2013-02-19 07:40:36

回答

0

使用此代碼在登錄與電子郵件BTN呈現的viewController:

LoginViewController *loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; 
    [self presentModalViewController:loginViewController animated:NO]; 

而對於回到你的登錄頁面將此代碼放在註銷BTN:

[self dismissModalViewControllerAnimated:NO]; 
+0

中,因此無法工作我不確定是否清除應用程序流。讓我修改它。登錄Facebook - > Tabcontroller(其中有註銷按鈕)和登錄電子郵件 - >其他控制器 – 2013-02-19 09:24:32

+0

當我點擊註銷並返回到控制器(其中有兩個登錄按鈕)後,我無法達到登錄與電子郵件 - >一些其他控制器 – 2013-02-19 09:28:25

+0

loginviewcontroler是一個vc包含註銷,顯示frnd,應用程序用戶等所有這些btn,對嗎? – Dilip 2013-02-19 09:32:47

0

可能會檢查你的代碼隨時隨地爲您不會禁止用戶交互的Log in with Email按鈕,同時出示您的LoginviaFacebook控制器。

+0

是的,檢查。它的第一次工作很好。但是,當我回來(點擊註銷後),然後點擊「使用電子郵件登錄」按鈕,它不起作用 – 2013-02-19 09:34:21

+1

是的,我明白了。可能是它沒有從頂部發布你的觀點或添加它。只需通過提供您的視圖的背景顏色來檢查。 – Madhu 2013-02-19 09:40:35

+0

該問題與NavigationController相關。點擊註銷後,無法推送「通過電子郵件登錄」 – 2013-02-19 09:50:34

1

你爲UITabBarController分配了什麼?我敢打賭UIViewController?嘗試在SomeViewController.m

[self.navigationController pushViewController:anotherViewController animated:YES]; 

anotherViewController.m

[self.navigationController popViewControllerAnimated:YES]; 

希望幫助

0

所以傢伙我解決了問題,分配UINavigationController代替UIViewController

UINavigationController *navController = [[UINavigationController alloc] init]; 
SomeViewController *viewController = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:nil]; 
navController.viewControllers = [NSArray arrayWithObject:viewController]; 

UITabBarController *tabBarController = [[UITabBarController alloc] init]; 
[tabBarController setViewControllers:[NSArray arrayWithObjects: 
viewController, nil]]; 

然後。下面的代碼應該已經放在註銷按鈕

UINavigationController * navigationController = [[UINavigationController alloc] initWithRootViewController:appDelegate.LoginviewController];

[self presentViewController:navigationController animated:YES completion:nil];

相關問題