0

I am having some problem to manage my cells in a tableview.

I have one table view with two sections: The first one, I have 3 custom cells, with static cells.

The second one, I have a dynamic type.

To work with the dynamic one, no problem is occurring, but the static, I don't know how to "reuse" them.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexpath.section = 0){
        //here is the question, how to return the stactis that had already been defined
    }else{
        return cell //here is okay, i can return the dynamic
}
Howli
  • 12,291
  • 19
  • 47
  • 72
vmfesta
  • 159
  • 1
  • 1
  • 9

1 Answers1

0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
     if(indexpath.section = 0){
         //here is the question, how to return the stactis that had already been defined
         static NSString *CellIdentifier = @"StaticCell";

         StaticCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
         return cell;


     }else{

        static NSString *CellIdentifier = @"DynamicCell";

         UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
         if(cell == nil){
            cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
            cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
         }
         return cell;
     }
iphonic
  • 12,615
  • 7
  • 60
  • 107
  • so each of the 3 static cells, i need to put an indentifier? the dynamic one i made different but works correctly – vmfesta May 26 '14 at 18:46