iPhone登录界面问题 [英] iPhone login screen problem

查看:144
本文介绍了iPhone登录界面问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型应用程序。它们之间有很多表格和导航。我作为'NavigationBasedProject'(xcode模板)开始了一个项目。但现在我需要在应用程序的开头添加登录。所以我到目前为止所做的是:
在'didFinishLaunchingWithOptions'中我添加了:

I have a large application. It has a lot of tables and navigation between them. I started a project as a 'NavigationBasedProject' (xcode template). But now I need to add login at the start of the application. So here what I did so far: In 'didFinishLaunchingWithOptions' I added:

loginViewController = [[LoginViewController alloc]init];
        [loginViewController.view setFrame:CGRectMake(0, 0, 320, 480)];
        [self.window.rootViewController presentModalViewController:loginViewController animated:NO];

当用户数据有效时,我会忽略登录屏幕:

When user data are valid I dismiss login screen like this:

[self.loginViewController dismissModalViewControllerAnimated:YES];

用户还可以从应用程序注销。然后我再次出现登录屏幕:

User can also logout from application. And then I present login screen again like this:

[self.window.rootViewController presentModalViewController:loginViewController animated:NO];

这是有效的。但是登录屏幕上的文本字段仍然填充了用户输入登录的数据。我担心这里有一些记忆问题。用户登录时如何从内存中完全删除登录屏幕。我不使用GUI设计器我从代码连接所有内容。
另外我想知道制作登录屏幕和模态视图是个好主意吗?

And this works. But text fields on login screen are still filled with data that user enter to login. And I am afraid that I have some memory issue here. How to remove login screen completely from memory when user logs in. I don't use GUI designer I connect everything from code. Also I wonder is it good idea to make login screen and modal view?

推荐答案

你应该使用... 。(我不知道为什么你在课堂级别声明 loginViewController

you should use.... (I don't know why you are declaring it loginViewController at class level)

LoginViewController *loginViewController = [[LoginViewController alloc]init];
            [loginViewController.view setFrame:CGRectMake(0, 0, 320, 480)];
            [self.window.rootViewController presentModalViewController:loginViewController animated:NO];
    [loginViewController release];

以及解雇.....

[self.window.rootViewController dismissModalViewControllerAnimated:YES];

谢谢,

这篇关于iPhone登录界面问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆