English 中文(简体)
如何从 iPhone 应用程序中登出并重定向到登录页面?
原标题:How to Logout from an iPhone application and re-direct it to login page?

我正在开发一个 TabBar 应用程序, 在那里我预设登录页面为模式化查看控制器。 在从页面登录后稍后, 我将显示 Tabbar 。 在其中的一个 Tab 中, 我有一个我的 Logout View 控制器, 在那里我要登出, 并将应用程序返回到登录页面。 我需要删除所有已装入的数据, 然后在重新下载时重新使用输入的数据。 我搜索了很多, 但无法找到任何帮助 。 请有人帮助我如何执行此功能吗?

最佳回答

如果您将登录视图显示为模式视图, 那么没有问题。 当用户成功登录退出时, 您可以再次这样做 。 只要通过再次显示登录页面, 显示登录页面 。

但我建议您将登录作为应用程序的根视图, 并在 App 代表中检查, 如果用户已经登录, 那么请参考您应用程序的主页 。 在登录按钮上, jst 弹出到登录视图控制器 。 这是 root 视图控制器 。

if([[DataModel sharedDataModel] getValueForKey:USER_SESSION_ID]!=nil) { objLoginController=[[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];

    UINavigationController *temp=[[UINavigationController alloc] initWithRootViewController:objLoginController];
    self.mNavigationController=temp;

    [temp release];
    [objLoginController release];
    objLoginController = nil;


    if(objHomeController==nil)
    {
        objHomeController=[[HomeController alloc] initWithNibName:@"HomeController" bundle:nil];
    }

    [self.mNavigationController pushViewController:objHomeController animated:NO];

    [objHomeController release];
    objHomeController=nil;

    [mNavigationController setDelegate:self];
    mNavigationController.navigationBar.hidden=TRUE;
    [self.view addSubview:mNavigationController.view];
}
else
{
    objLoginController=[[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];

    UINavigationController *temp=[[UINavigationController alloc] initWithRootViewController:objLoginController];
    self.mNavigationController=temp;

    [temp release];
    [objLoginController release];
    objLoginController = nil;

    [mNavigationController setDelegate:self];
    //mNavigationController.navigationBar.hidden=TRUE;
    //[mNavigationController setNavigationBarHidden:NO animated:YES];
    [self.view addSubview:self.mNavigationController.view];
}
问题回答

暂无回答




相关问题
Best logging approach for composite app?

I am creating a Composite WPF (Prism) app with several different projects (Shell, modules, and so on). I am getting ready to implement logging, using Log4Net. It seems there are two ways to set up the ...

How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

How to validate Java logging properties files?

I have a basic facility for allowing users to remotely apply changes to the logging files in my application. Some logs are configured using java.util.logging properties files, and some are configured ...

Logging SAS scripts

I ve been developing a lot of Java, PHP and Python. All of which offer great logging packages (Log4J, Log or logging respectively). This is a great help when debugging applications. Especially if the ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

热门标签