Change UITableView height dynamically iOS7

This question already has an answer here:


ANSWERS:


I understand what you're trying to do. Here is what you should do:

  1. Add height constraint to your UITableView
  2. Wrap it in custom UIView
  3. Make a custom class MyCustomView:UIView
  4. Set class in IB for your wraper UIView to your class from step 3.
  5. Make connection from constraint in IB to your class
  6. Make a connection between table view and your class
  7. Put code into your new class:
- (void) layoutSubviews {
  // set height 0, will calculate it later
  self.constraint.constant = 0;

  // force a table to redraw
  [self.tableView setNeedsLayout];
  [self.tableView layoutIfNeeded];

  // now table has real height
  self.constraint.constant = self.tableView.contentSize.height;
}

To change the cell height:

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

To change tableView height:

tableView.size.height = 100;


 MORE:


 ? Autolayout - Vertically center two views in a UITableViewCell when one view has dynamic height
 ? UITableViewCell in nib or storyboard
 ? Change Height of UITableView Customcell
 ? Auto resize a cell in tableview based on dynamic input
 ? IOS:Multiple PrototypeCells in UITableView
 ? Dynamic cell height for tableview
 ? UITableViewCell of different heights
 ? UITableViewCell, UITextView with dynamic height
 ? UITableViewCell becomes unresponsive
 ? Calculate dynamic height of uitableviewcell