iPhone login screen problem(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登录屏幕问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone登录屏幕问题
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- URL编码Swift iOS 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- UITextView 内容插图 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
