Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom TableViewCell is not called (programmatically)
    primarykey
    data
    text
    <p>I´ve been searching a long time through a lot of code here but nothing helped me....</p> <p>I created a custom TableViewCell programatically and i want to connect them with another view. Here is my Code.</p> <p>The .h File</p> <pre><code>// 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 </code></pre> <p>The .m File</p> <pre><code>@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; } </code></pre> <p>And here is the important part of the other View:</p> <pre><code>- (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; } </code></pre> <p>I only get empty Cells, my only Idea is that i use Views and not UILabels?</p>
    singulars
    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.
 

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