таблица посмотреть следующие результаты - PullRequest
0 голосов
/ 06 августа 2010

Как это реализовано в табличном представлении?Чтобы ограничить отображение результатов в табличном представлении, мне нужно отобразить, например, 10 результатов, затем в последней части ячейки таблицы есть часть «следующие результаты», при выборе которой будет загружен / вставлен следующий набор данных в табличное представление.

Pls.Посоветуй мне.Спасибо

1 Ответ

1 голос
/ 06 августа 2010

Вы можете сделать 2 раздела 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
    }

}

Конечно, это не единственное решение, но оно работает ...

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...