I use autoLayout for my customCell in xib because I want to have a variable height for text based strings.
Now in my VC.m
I use these lines of code
- (void)viewdidLoad
{
m_tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
m_tableView.estimatedRowHeight = 97.0;
m_tableView.rowHeight = UITableViewAutomaticDimension;
}
here is my cellForRow function
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomCell *tableCell = (NotesCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (tableCell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
tableCell = [nib objectAtIndex:0];
}
tableCell.layoutMargins = UIEdgeInsetsZero;
tableCell.preservesSuperviewLayoutMargins = NO;
return tableCell;
}
So, whenever I update a line, I call these lines of code
[m_tableView beginUpdates];
[m_tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:m_indexPath] withRowAnimation:UITableViewRowAnimationFade];
[m_tableView endUpdates];
When I do this, Tableview just bounces. I do not know what is going wrong.
Ranjit Relations
source
share