objective c - Custom TableViewCell is not called (programmatically) -


i´ve been searching long time through lot of code here nothing helped me....

i created custom tableviewcell programatically , want connect them view. here code.

the .h file

//  gtcustomcellview.h #import "gtview.h" @interface gtcustomcellview : uitableviewcell @property (nonatomic, retain) gtview* containerview; @property (nonatomic, retain) gtimageview* commentimageview; @property (nonatomic, retain) gttextview* commentview; @property (nonatomic, retain) gttextview* dateview; @property (nonatomic, retain) gttextview* authorview; @property (nonatomic, retain) gtview* groupview; @property (nonatomic, retain) uilabel* mainview;  @end 

the .m file

@implementation gtcustomcellview   - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) {      self.layout = [[[gtflowlayout alloc] initwithspacing: 0] autorelease];     self.backgroundcolor = gtdefaultbackgroundcolor;       self.containerview = [[[gtview alloc] initwithframe:cgrectmake(0.0, 0.0, self.frame.size.width, 100.0f)]autorelease];     [self.contentview addsubview:self.containerview];       self.commentimageview = [[[gtimageview alloc] initwithframe:cgrectmake(0.0f, 0.0f, 70.0f, 70.0f)] autorelease];     [self.containerview addsubview:self.commentimageview];       self.groupview =[[[gtview alloc] initwithframe:cgrectmake(70.0, 0.0, self.frame.size.width - self.commentimageview.frame.size.width, self.containerview.frame.size.height)]autorelease];     [self.containerview addsubview: self.groupview];       self.authorview = [[[gttextview alloc] initwithframe:cgrectmake(0.0, 0.0, self.frame.size.width, 20.0f)]autorelease];     [self.groupview addsubview:self.authorview];      self.dateview = [[[gttextview alloc] initwithframe:cgrectmake(0.0, 20.0, self.frame.size.width, 20.0f)]autorelease];     [self.groupview addsubview:self.dateview];      self.commentview = [[[gttextview alloc] initwithframe:cgrectmake(0.0, 40.0, self.frame.size.width, 60.0f)]autorelease];     [self.groupview addsubview:self.commentview];   } return self; } 

and here important part of other view:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {  static nsstring *cellidentifier = @"cell";  gtcustomcellview *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     cell = [[[gtcustomcellview alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; }   cell.authorview.text = @"author test"; cell.dateview.text = @"date test"; cell.commentview.text = @"comment test";   return cell; } 

i empty cells, idea use views , not uilabels?

please use - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier instead of initwithframe

additional information here:is ok use initwithframe custom tableviewcell after iphone sdk 3.0?


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -