English 中文(简体)
• 如何利用受限控制来使用户停下来
原标题:How to use UISegmented control to keep the user logged in

I m 提供一种简单的信息,即把模式观点装上根基控制器,而模式观点则对使用者进行分门别类的控制,以选择他/她是否希望停留。 模式观点有一个用户名称和密码领域,其次为: 在对用户进行核实之后,他/她将被带往有县子将用户带往另一种观点,即特性1,特征2等。 如果用户利用背顿(由导航控制员驱动),我不想再次向用户索取其证书,因为那次评估再次把根基控制器装上,从而使用分部分控制。

How can use and implement the segmented control in this case? Thanks!

最佳回答

我假定你们会实现这一点,但你需要储存日志的全权证书,我假定你的问题是怎样?

如果你想把标识证书储存在一生中(在你关闭时,这些证书就被贴上标签),那么我会把全球级变量储存起来,以便它们能够从这里的任何地方参考。

If you want to keep the login credentials stored longer (i.e. they may still be logged in if they close and reopen the app), you should use NSUserDefaults:

写作:

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"UserIsLoggedIn"];
[[NSUserDefaults standardUserDefaults] synchronize];

阅读:

BOOL loggedIn = [[NSUserDefaults standardUserDefaults] boolForKey:@"UserIsLoggedIn"];

还请注意以下考虑:

  • UserDefaults aren t secure. Please don t store passwords there without encrypting them.
  • boolForKey: returns NO if the key you provide doesn t exist
问题回答

Why are u going for UISegmentedController? Just use simple UIBarButtonItem as Logout button on RootViewControllers navigation bar.
In RootViewControllers viewWillAppear/viewDidAppear method check wheather user is already Logged in or not. Based on that loads modal view.





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签