Dynamic Cell Size in UITableView - new iOS 8 api

One of the new iOS-8 api allow the developers to provide dynamic height to their tableView cells without much hassle. So now we don’t have to implement the following method

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
}



Instead we need to add this

  self.tableView.estimatedRowHeight = estimatedHeight;
  self.tableView.rowHeight = UITableViewAutomaticDimension;

And apply the appropriate constraints in the xib/storyboard of the cell which will help xcode to correctly calculate its height.


So now you don’t need to make a function that will return the dynamic/changed height of every cell. iOS-8 api will do it for you provided you follow the above process !


 
49
Kudos
 
49
Kudos

Now read this

iOS < Design, Development > issue - 3

devRead # Objc.io - issue 15 prototyping animations in swift - part 1 prototyping animations in swift - part 2 iOS-8 day-by-day - day 18 why people are turning off push tools # Package manager for Xcode Kiwi - Behavior Driven Development... Continue →