2010-08-06 4 views
0

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

Pls. Посоветуй мне. Благодаря

ответ

1

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

} 

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