Pergunta

I've an app with this layout:

When you open the app you see a login screen. You log in and you see a tabbar with 3 tabs. (The loginview is displayed with a presentModalView in the appdelegate of tabbar).

In the third tab there is a logout button. I want when logout button is pressed the app delete NSUserDefaults and shows the loginview again. And if you login again the login screen disappear and you see the first tab of the tabbar.

How can I do this?

Foi útil?

Solução

Do as follows,

  1. Place your login view in first view controller.

  2. Place your tabbar controller in second view controller.

  3. Store the second viewcontroller instance in appDelegate (this will be used for navigation).

  4. Now when the logout button is pressed,use the stored instance navigate your view.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top