Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First you create some custom UITableViewCell classes (.h and .m), as many as you have xib files:<BR> So you could have CellType1 and CellType2 for example.<br> CellType1.h would look something like</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface CellType1 : UITableViewCell @property(nonatomic,strong) IBOutlet UILabel *customLabel; @end </code></pre> <p>Then you create the xib files, you can use default view type, but then, just remove the view that is automatically created, replace that by a UITableViewCell, and change the class to CellType1. Do the same for CellType2.</p> <p>Then in your tableViewController, write cellForRow like this:</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell=nil; //We use CellType1 xib for certain rows if(indexPath.row==&lt;whatever you want&gt;){ static NSString *CellIdentifier = @"CellType1"; cell =(CellType1*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"CellType1" owner:self options:nil]; cell = (CellType1 *)[nib objectAtIndex:0]; } //Custom cell with whatever [cell.customLabel setText:@"myText"] } //We use CellType2 xib for other rows else{ static NSString *CellIdentifier = @"CellType2"; cell =(CellType2*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"CellType2" owner:self options:nil]; cell = (CellType2 *)[nib objectAtIndex:0]; } //Custom cell with whatever [cell.customLabel setText:@"myText"] } return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload