views:

18

answers:

1

How it is being implemented in table view? To limit the results display in the table view, I need to display eg 10 results, then at the last part of the table cell there's the "next results" part when selecting would load/insert the next set of data into the table view.

Pls. advise me. Thanks

+1  A: 

You can make a 2 section UITableView...

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (indexPath.section == 0)
        return 10;
    else {
        return 1;
    }

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableView *cell;
    if (indexPath.section == 0)
        cell = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"normalCell"];
    else
        cell = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"nextCell"];

    if (!cell) {
        if (indexPath.section == 0)
            cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"normalCell"];
        else
            cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"nextCell"];
    }

    if (indexPath.section == 0) {
        // Set your normal cells
    } else {
        // Set your next cell
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        // your normal cells here
    } else {
        // your next cell here
    }

}

Of course this is not the only solution, but it works...

TheSquad