ios - UITableView Mix of Static and Dynamic Cells? -


i know cannot mix static , dynamic cell types in single uitableview couldn't think of better way describe issue.

i have several predetermined cells fixed content, have unknown number of cells dynamic content sits in middle. want table this:

fixed fixed fixed dynamic dynamic dynamic dynamic dynamic fixed fixed 

so how recommend approach in cellforrowatindexpath method?

thanks.

as stated can't mix static , dynamic cells. however, can break content different data arrays correspond each group. break table difference sections , load data correct array in cellforrowatindexpath:.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellid = @"cellid";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellid forindexpath:indexpath];      switch (indexpath.section) {         case 0:{             cell.textlabel.text = self.arrayofstaticthings1[indexpath.row];         }break;          case 1:{             cell.textlabel.text = self.arrayofdynamicthings[indexpath.row];         }break;          case 2:{             cell.textlabel.text = self.arrayofstaticthings2[indexpath.row];         }break;          default:             break;     }      return cell; }    - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     switch (section) {         case 0:{             return self.arrayofstaticthings1.count;         }break;          case 1:{             return self.arrayofdynamicthings.count;         }break;          case 2:{             return self.arrayofstaticthings2.count;         }break;          default:             return 0;             break;     } } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -