그룹화 된 테이블로 출력하고있는 리뷰 배열이 있습니다. 내가 section methods를 [array count]로 보냈을 때 각 리뷰가 그것의 자신의 tableview 섹션에 있기를 원한다. 단지 많은 아이템이 배열에있는 동안 같은 그룹을 반복한다. 어떤 생각이라도 어떻게 할 수 있니? 나는 그것이 의미가 있기를 바랍니다. 감사합니다UITableView는 모든 섹션에 새 정보를 그룹화했습니다.
--EDIT--
추가 내가 무엇을 달성하고자하는의 사진과 cellForRow/제/DidSelectRowMethod의 내가이 당신 때문에 모든
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
static NSString *CellIdentifier = @"Cell";
CustomCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
cell.primaryLabel.text = [object objectForKey:@"comment"];
if([[object objectForKey:@"rating"] isEqualToString:@"0"])
{
cell.myImageView.image = [UIImage imageNamed:@"rating_0.png"];
}
if([[object objectForKey:@"rating"] isEqualToString:@"1"]) {
cell.myImageView.image = [UIImage imageNamed:@"rating_1.png"];
}
if([[object objectForKey:@"rating"] isEqualToString:@"2"])
{
cell.myImageView.image = [UIImage imageNamed:@"rating_2.png"];
}
if([[object objectForKey:@"rating"] isEqualToString:@"3"])
{
cell.myImageView.image = [UIImage imageNamed:@"rating_3.png"];
}
if([[object objectForKey:@"rating"] isEqualToString:@"4"])
{
cell.myImageView.image = [UIImage imageNamed:@"rating_4.png"];
}
if([[object objectForKey:@"rating"] isEqualToString:@"5"])
{
cell.myImageView.image = [UIImage imageNamed:@"rating_5.png"];
}
return cell;
}
// Override if you need to change the ordering of objects in the table.
- (PFObject *)objectAtIndex:(NSIndexPath *)indexPath
{
return [self.objects objectAtIndex:indexPath.row];
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PFObject *object = [self.objects objectAtIndex:indexPath.row];
Review *review = [[Review alloc] initWithNibName:@"Review" bundle:nil];
review.Name = [object objectForKey:@"userId"];
NSLog(@"%@",[object objectForKey:@"userId"]);
review.rating = [object objectForKey:@"rating"];
review.comments = [object objectForKey:@"comment"];
[self.navigationController pushViewController:review animated:YES];
[review release];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [self.objects count];
}
질문을 좀 더 명확하게 게시 할 수 있습니까? – Minakshi
sidenote ... 당신은 모든 if 문을 다음으로 대체 할 수 있습니다 :'cell.myImageView.image = [UIImage imageNamed : [NSString stringWithFormat : @ "rating _ % @. png", [object objectForKey : @ "rating" ]]]; ' – Alladinian