开发者

How to add a logout feature to an iPhone app?

开发者 https://www.devze.com 2023-01-28 06:18 出处:网络
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 tab

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 show开发者_如何学运维s 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消