ios - Inconsistent UITableViewCell Size When Updating Cells -


when attempt update table **uitableview** using code below cells become smaller. wondering if has faced same problem , know why happening.

 nsmutablearray* indexpaths = [[nsmutablearray alloc] init];  (int = 20; < 20 + 20; i++) {      [indexpaths addobject:[nsindexpath indexpathforrow:i insection:0]];  }   [self.tableview beginupdates];  [self.tableview insertrowsatindexpaths:indexpaths withrowanimation:(uitableviewrowanimationbottom)];  [self.tableview endupdates]; 

....

@creativitykills.

if auto layout on please try following method add after add rows. may if problem of auto-layout.

 nsmutablearray* indexpaths = [[nsmutablearray alloc] init];  (int = 20; < 20 + 20; i++) {      [indexpaths addobject:[nsindexpath indexpathforrow:i insection:0]];  }   [self.tableview beginupdates];  [self.tableview insertrowsatindexpaths:indexpaths withrowanimation:(uitableviewrowanimationbottom)];  [self.tableview endupdates];  [self adjustheightoftableview];   - (void)adjustheightoftableview {     cgfloat height = self.tableview.contentsize.height;     cgfloat maxheight = self.tableview.superview.frame.size.height - self.tableview.frame.origin.y;      // if height of content greater maxheight of     // total space on screen, limit height size of     // superview.      if (height > maxheight)         height = maxheight;      // set height constraint accordingly      [uiview animatewithduration:0.25 animations:^{         self.tableviewheightconstraint.constant = height;         [self.view setneedsupdateconstraints];     }]; } 

hope may you.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -