guys i want to set different subview in every section, i put my different view into NSMutableArray, so i hope i can access it depend on indexPath.section, this is my code :
for (int i =0; i<promoCount; i++) {
self.textView.text= [NSString stringWithFormat:@"text view :%d",i];
[self.arrayPromotions addObject:self.textView];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellPromotionIdentifier = @"cellPromo";
cell = [tableView dequeueReusableCellWithIdentifier:cellPromotionIdentifier];
if (cell==nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellPromotionIdentifier] autorelease];
}
[cell.contentView addSubview:[self.arrayPromotions objectAtIndex:indexPath.section]];
cell.contentView.layer.masksToBounds = YES;
cell.contentView.layer.cornerRadius = 5.0;
return cell;
}
But it doesn't work, subview just appear in the last section (but content of that subview is right).
iam sure that array have been filled by different view (by doing NSLog).
anybody can help me.????