ios - Rearrange autoLayout after changes during view -


i have 2 tableviews (one @ top, other @ bottom) in storyboard , auto-layout set , working. tableviews, retrieving data database, won't instantly display tableview content. after retrieving data completed, in numberofrowsinsection changing height of tableview depending on count.

 if tableview == self.tableview1 {     count = tableview1content.count      if count != nil {       let cellsize = 100        switch count! {          case 0:            tableview.frame.size.height = cgfloat(0)            break;          case 1:            tableview.frame.size.height = cgfloat(cellsize)          case 2:            tableview.frame.size.height = cgfloat(cellsize * 2)          default:            print("d")            break;       }     } } 

so can change height of tableview1. tableview2 has 'top space tableview1' of 10, height change happens after view loaded, tableview2 doesn't adjust keep 'top space tableview1'

you changing frame size not height constraint constant. should connect height constraint (iboutlet) , change height, after change call self.view.layoutifneeded()

here example of animating constraints.