当数据库 (FMDB) 加载 iPhone 时显示启动屏幕 (UIViewController)
我的申请有点问题。
我有 Web 服务,它接收信息,然后解析信息并将信息存储在数据库中。
我想要的是显示我的启动屏幕(或 UIViewController),直到所有信息上传到数据库(FMDB 是我正在使用的数据库)。
目前,我的屏幕加载一段时间后就会被删除。 我使用的代码是:[self PerformSelector:@selector(removeSplashScreen) withObject:nil afterDelay:30];
问题是一些信息已加载到数据库,而其他信息则没有。
任何人都可以给我有关如何解决此问题的提示吗?
注意:启动屏幕实际上并不是启动屏幕(即 Default.png),这只是启动屏幕之后显示的 UIViewController,我只是将其称为启动屏幕。
谢谢
I have a bit of issue with my application.
I have WebServices that receive information than parse it and store the information in a database.
What I want is my splash screen (or UIViewController) to be display until the all of information is uploaded to the database (FMDB is the db I am using).
Currently what I have a the screen loading for a certain period of time and than it is removed.
The code I am using is:[self performSelector:@selector(removeSplashScreen) withObject:nil afterDelay:30];
The problem is some of the information is loaded to the database, while other isn't.
Can any give me hints on how to resolve this issue.
NOTE: The splash screen isn't that actually splash screen (which is Default.png), this is just a UIViewController
displayed after that splash screen I am just calling it the splash screen.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过提供通知或委托方法来指示解析完成来完成此操作。然后可以使用它来删除启动屏幕。
也就是说,在数据加载之前显示启动屏幕并不是一个好方法。如果加载数据有相当大的延迟怎么办?请重新考虑你的方法。通常这种做法并不适合苹果公司。
You can do this by providing a notification or delegate method to indicate the completion of the parsing. This can then be used to remove the splash screen.
That said its not a good approach to show the splash screen till the data is loaded. what if there is a considerable delay for loading the data. Please rethink your approach. This approach wont go well with Apple normally.
如果您的数据库代码有可用的回调函数(下载、解析和保存),请使用该函数删除闪屏控制器。
将数据存储到数据库后,你用它做什么?你是否将它显示到表格或网络视图或其他东西中?了解这个问题的答案将有助于优化您的闪屏目标的解决方案。
编辑:
If you have a call back function available from your database code(which download, parse and save), use that function to remove the splash screen controller.
After storing the data into database, what are you doing with it?? are you displaying it into a table or webview or something else?? Knowing answer to this, will help in optimizing the solution to your splash screen goal.
Edit: