Sunday, 15 January 2012

ios - UITableView bounces with estimatedRowHeight -


I am using autoLayout in xib for my customcell because I want variable height for lines based on text.

Now my VCM

I am using these lines of code

  - (zero) viewdidLoad {m_tableView.tableFooterView = [[UIView alloc] initWithFrame: CGRectZero]; M_tableView.estimatedRowHeight = 97.0; M_tableView.rowHeight = UITableViewAutomaticDimension; }  

Here is my cellphone function

  - (UITableViewCell *) Table view: (UITableView *) Table view CellForAreAandPath: (NSIndexPath *) indexPath {static} NSString * Cell identifier = @ "cell"; Customcell * tableclass = (notices *) [tableview dequirer usecallvite identifier: cell identifier]; If (tableCell == blue) {NSArray * nib = [[NSBundle mainBundle] loadNibNamed: @ "customcell" owner: self choice: zero]; Table cell = [nib object at index: 0]; } // Configure cell ... // This code separator is used to make the full width. Apart from this tableViewage Separator Insets should be set in Zero Table Cell.layoutMargins = UIEdgeInsetsZero; TableCell.preservesSuperviewLayoutMargins = No; Return table cell; }  

So whenever I update a line, I call these lines of code

  [m_tableView startupdates]; [M_tableView reloadRowsAtIndexPaths: [NSArray arrayWithObject: m_indexPath] with Row Animation: UITableViewRowAnimationFade]; [M_ tableView and Updates];  

As long as I do this, the tableview bounces by. I do not know what's going wrong ...

Regards Ranjit

That's why Because when you reload your cell, see the table again asking for the height of all the cells. Any cell in the office above your scroll position will be asked for their estimated line heights and if they are different from their current height then it will give the cells the reason for the height change and you will see the table boom in this way.

Once your cells are calculated, you can cache that value somewhere and then apply the tableView: estimated heat forerearted path: and cells Can return the actual height of if they have one instead of the expected height


No comments:

Post a Comment