ios - UItableViewCell not the right size -


creating .xib:

enter image description here

set class:

enter image description here

this how shows:

enter image description here

here how load cell:

@implementation fieldinfotableviewcontroller  - (void)viewdidload {     [super viewdidload];      uinib *cellnib = [uinib nibwithnibname:@"fieldinfocell" bundle:nil];      [self.tableview registernib:cellnib forcellreuseidentifier:fieldinfocellindentifier]; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     if (indexpath.section == 0) {         fieldinfocell *fieldcell = [tableview dequeuereusablecellwithidentifier:fieldinfocellindentifier forindexpath:indexpath];          fieldcell.fieldnamelabel.text = self.boundarier.name;          return fieldcell;     }      static nsstring *cellidentifier = @"cell";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];      return cell; } 

fielcinfocell:

@interface fieldinfocell : uitableviewcell  @property (strong, nonatomic) iboutlet uilabel *fieldnamelabel;  @end  @implementation fieldinfocell  - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier {     self = [super initwithstyle:style reuseidentifier:reuseidentifier];     if (self) {         // initialization code     }     return self; }  - (void)setselected:(bool)selected animated:(bool)animated {     [super setselected:selected animated:animated];      // configure view selected state }  @end 

the label being renamed, cell size , background color not being set.

edit:

i set height in ib:

enter image description here

added:

-(cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     return 150; } 

and gives me height, still no background color. kinda leads me think i'm not setting else correctly.

you can set tableview row height uitableviewdelegate:

    - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath{        return your_height;      } 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -