Hi,
So I've got a custom tableviewcells set up programmatically. I have 4 classes of custom cells, one custom cells for one section. But i don't know if it's wrong or not :
- (UITableViewCell *)tableView:(UITableView *)TheTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *ShopsIdentifier = @"ShopsIdentifier";
static NSString *DescriptionsIdentifier = @"DescriptionsIdentifier";
static NSString *ServicesIdentifier = @"ServicesIdentifier";
static NSString *PartnersIdentifier = @"PartnersIdentifier";
if (indexPath.section == kShops) {
NSLog(@"Chargement cellule ShopDetailCell");
ShopDetailCell * shopshopCell = (ShopDetailCell *)[tableView dequeueReusableCellWithIdentifier:ShopsIdentifier];
if (shopCell == nil) {
shopCell = [[[ShopDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ShopsIdentifier] autorelease];
}
shopCell.detailController = self;
shopCell.shop = self.shop;
return shopCell;
}
if (indexPath.section == kDescriptions) {
NSLog(@"Chargement cellule DescriptionCell");
DescriptionCell * descriptionCell = (DescriptionCell *)[tableView dequeueReusableCellWithIdentifier:DescriptionsIdentifier];
if (descriptionCell == nil) {
descriptionCell = [[[DescriptionCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DescriptionsIdentifier] autorelease];
}
descriptionCell.shop = self.shop;
return descriptionCell;
}
if (indexPath.section == kServices) {
NSLog(@"Chargement cellule ServicesCell");
ServicesCell * servicesCell = (ServicesCell *)[tableView dequeueReusableCellWithIdentifier:ServicesIdentifier];
if (servicesCell == nil) {
servicesCell = [[[ServicesCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ServicesIdentifier] autorelease];
}
servicesCell.shop = self.shop;
return servicesCell;
}
if (indexPath.section == kPartners) {
PartnersCell * partnersCell = (PartnersCell *)[tableView dequeueReusableCellWithIdentifier:PartnersIdentifier];
if (partnersCell == nil) {
partnersCell = [[[PartnersCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:PartnersIdentifier] autorelease];
}
NSMutableDictionary * aPartner = [[NSMutableDictionary alloc] init];
aPartner = [shop.partners objectAtIndex:indexPath.row];
partnersCell.partner = aPartner;
[aPartner release];
return partnersCell;
}
return nil;
}
Thanks in advance.