当数据库 (FMDB) 加载 iPhone 时显示启动屏幕 (UIViewController)

发布于 2024-12-04 10:50:19 字数 426 浏览 0 评论 0原文

我的申请有点问题。
我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

彩虹直至黑白 2024-12-11 10:50:19

您可以通过提供通知或委托方法来指示解析完成来完成此操作。然后可以使用它来删除启动屏幕。
也就是说,在数据加载之前显示启动屏幕并不是一个好方法。如果加载数据有相当大的延迟怎么办?请重新考虑你的方法。通常这种做法并不适合苹果公司。

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.

呆萌少年 2024-12-11 10:50:19

如果您的数据库代码有可用的回调函数(下载、解析和保存),请使用该函数删除闪屏控制器。
将数据存储到数据库后,你用它做什么?你是否将它显示到表格或网络视图或其他东西中?了解这个问题的答案将有助于优化您的闪屏目标的解决方案。

编辑:

if (nodeCount == 0 && indexPath.row == 0)
{
     cell.detailTextLabel.text = @"Loading…";

     return cell;
}// Leave cells empty if there's no data yet
if (nodeCount > 0)
{
     //fill cells with actual data that is present in database
     return cell;
}

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:

if (nodeCount == 0 && indexPath.row == 0)
{
     cell.detailTextLabel.text = @"Loading…";

     return cell;
}// Leave cells empty if there's no data yet
if (nodeCount > 0)
{
     //fill cells with actual data that is present in database
     return cell;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文