here is my code, in my app, I use a custom UITableViewCell for each cell in the UITableView, and calculate the cell height in "heightForRowAtIndexPath", but if I use "dequeueReusableCellWithIdentifier" , the cell is overlapped when scroll the table view. and issue gone when don't use "dequeueReusableCellWithIdentifier". don't know why this issue happen?
actually, I want to know if not use "dequeueReusableCellWithIdentifier" to create the cell, does there will cause any memory issue if the tableview display a lot cells?
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
// Return the number of rows in the section.
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier = @"threadCell";
SYGBBSTableViewCell * cell=nil;
//if I comment below line code , the cell overlap issue solved
cell = (SYGBBSTableViewCell*) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[SYGBBSTableViewCell alloc] initMessagingCellWithReuseIdentifier:cellIdentifier];
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
-(void)configureCell:(SYGBBSTableViewCell*)cell atIndexPath:(NSIndexPath *)indexPath {
SYGBBSTableViewCell* ccell = (SYGBBSTableViewCell*)cell;
...
cell.content.text=content;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath;
{
/// Here you can set also height according to your section and row
NSDictionary* thread = [MyGoController getBBSThreadAtIndex:indexPath.row];
int height = [SYGBBSTableViewCell cellHeightForThreadAt:thread];
return height;
}
if (cell == nil)- meda