开发者

display splash screen (UIViewController) while database (FMDB) is loading iPhone

开发者 https://www.devze.com 2023-04-04 06:51 出处:网络
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.

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


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:

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号