Я пошел вперед и сделал очень простую версию того, чего вы пытаетесь достичь.Посмотрите, поможет ли это вообще.То, как я это сделал, состояло в том, что я пошел дальше и изменил источник данных UITableView.Что в конечном итоге вы можете делать, чтобы загрузить больше историй.Главное, что нужно помнить, если вы изменяете источник данных, вам необходимо перезагрузить tableView.
- (void)viewDidLoad {
NSArray *array = [[NSArray alloc] initWithObjects:@"Story 1", @"Story 2", @"Story 3", @"Story 4", @"Story 5", @"More Stories", nil];
self.stories = array;
[array release];
[super viewDidLoad];
}
// TableView DataSource Methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [stories count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease];
}
cell.textLabel.text = [stories objectAtIndex:[indexPath row]];
return cell;
}
// TableView Делегаты
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if ([indexPath row] == [stories count] - 1) {
//Get more stories
[table deselectRowAtIndexPath:indexPath animated:YES];
NSArray *array = [[NSArray alloc] initWithObjects:@"Story 1*", @"Story 2*", @"Story 3*", @"Story 4*", @"Story 5*", @"Loading...", nil];
self.stories = array;
[array release];
NSArray *arr = [[NSArray alloc] initWithObjects:indexPath,nil];
[table beginUpdates];
[table reloadRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationFade];
[table endUpdates];
}
else {
//Call your methods to load the stories.
}