iPhone登录屏幕问题 [英] iPhone login screen problem

查看:18
本文介绍了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天全站免登陆