First, i have a slide application, there i have a tableview. By tapping a cell "CellInMainMenu" in the main menu, application opens tableview "TV1" by push, and cells in this tableview("TV1") fill with data by an array. When i slide this tableview("TV1") to side, and tapps again on a cell "CellInMainMenu", application opens again tableview("TV1"), but! Tableview("TV1") starts AGAIN to fill cells with information! How to make application load all data by once at starting application?
(I'm really sorry for my English, because it's not my language)
Can somebody help me?
Code in "TV1":
- (void)viewDidLoad
{
[super viewDidLoad];
daoDS = [[SampleDataDAO alloc] init];
self.ds = daoDS.PopulateDataSource;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"TV1CellId";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
SampleData *sample = [self.ds objectAtIndex:indexPath.row];
cell.textLabel.text = sample.HeroesName;
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.font = [UIFont fontWithName:@"Trajan-Regular" size:18.0f];
return cell;
}
(All appliction works fine, i just want to know how to make just one load but not every time)