1

I'm developing a very simple iOS app. For a signed-in user, it would display a tab-view with two tabs: Foo and Bar.

The problem is, where do I add user sign-in page?

  1. Add as a root view to main storyboard. Whenever user logged out, start over from root view
  2. Add as a separated view to be modal-ed by Foo tab. I feel this approach a bit weird since it differentiate one tab from another.
  3. Any other approach you may suggest.

Thanks for your help!

fengye87
  • 2,433
  • 4
  • 24
  • 41
  • 1
    Ideally, if you are looking for a authenticated access to the app, then root view controller seems more logical. However, it all depends on which part of your application flow would be taken by the login screen. For e.g., login can be one time in the settings which is not on the root view controller. So, basically you need to first work upon your application flow and decide the authentication. – Deepak Badiger Jun 17 '15 at 14:39
  • I like to display login view in a separate window and I usually set its windowLevel to between status bar and alerts. – Peter Zhou Jun 17 '15 at 15:06
  • Something like this https://github.com/shuningzhou/LoginWindow.git – Peter Zhou Jun 17 '15 at 15:33
  • @DeepakBadiger: the app is authenticated user only app, which means only authenticated access is allowed. So logging-in should be the first and required thing here. From your comment, I suppose you suggest root view controller approach then? – fengye87 Jun 17 '15 at 16:30
  • @PeterZhou: Hmm, since the app is requiring authentication before any use (like twitter or facebook), it doesn't feel right popping-up the sign-in view from *Foo* tab. I'm thinking sign-in should be the first thing here, making it the first view in storyboard? – fengye87 Jun 17 '15 at 16:38
  • @fengye87 You do not need to worry about from which view your sign-in view is displayed if you used a separate window. – Peter Zhou Jun 17 '15 at 17:10
  • @fengye87 If authentication is the first thing to do just show the sign-in window on application launch. Please see the updated example.https://github.com/shuningzhou/LoginWindow.git – Peter Zhou Jun 17 '15 at 17:15
  • @fengye87 The idea is that your application has two windows. One for its content. One for user sign-in. The sign-in window is always above the content window. And you can control whether to show the sign-in window or not. – Peter Zhou Jun 17 '15 at 17:23
  • @PeterZhou: I ended up with http://stackoverflow.com/questions/19962276/best-practices-for-storyboard-login-screen-handling-clearing-of-data-upon-logou. Many thanks to you, it's been really nice of you writting a code sample for this! – fengye87 Jun 18 '15 at 03:39
  • agree with peterZhou. @fengye87 hope you found the solution to your problem statement. – Deepak Badiger Jun 19 '15 at 11:33

0 Answers0