views:

372

answers:

1

hello, in my (quite simple) application,

--> i have one subview (named "Splash") loaded in the main view at launch time, like this (in my mainView class) :

-(void)awakeFromNib{
 [self addSubview:splash];
}

--> I have also a UITableView (named "myTable") loaded by clicking a button (which calls the IBAction named "LoadData:") in the subview "splash". (all views are made in interfaceBuilder, and each views have their corresponding classes in the xCode project)

What i want to do is to preload (cache) large amount of data (750 entries) from a SQLite database, before i load the second subView ("myTable"), which is using this data stored in an array.

To perform this, i have a method called "RefreshData:", which is called at a certain time to store the results in an array. This array is used in the UITableView to show this data. All is running perfectly well, but...

  • if i call "RefreshData" method at the end of the "awakeFromNib" method in the "mainView" class, my app takes ~15 seconds to show the first screen (named "splash") : not good.
  • if i call "RefreshData" within the IBAction "LoadData", the UITableView takes ~13 seconds to appear on screen : not good at all.

So, the question is : is there a way to call the "RefreshData" method AFTER the first subView ("splash") did appear on screen, and BEFORE user clicks on the button which loads the UITableView ?

Any help will be appreciated, and please apologizes for my bad english !

A: 

Try calling refreshData a little later ie in

-(void) viewDidAppear:

Also if the SQL request is locking up the GUI you should perhaps think about pulling the data off in a new thread (although I thought SQL did this)

Chris Beeson
hem...OK, but, where do I have to put this method ?Actually, i had no viewController in my app.So i've tried to add one, connect it to the "Splash" subView, and add into the Splash class implementation :-(void)viewDidAppear:(BOOL)animated{NSLog("@something");[mainView refreshData];}nothing happens... :-(what's wrong ?
Doesn't it get called at all? and I think it should be [self refreshData] if that method is within the VC.
Chris Beeson
No, nothing happens, even with the NSLog call.I will try to put refreshData in the VC.