ios - tableview contentsize not get updated, when changing NSLayoutConstraint's constant -


i have added bottom constraint on tableview, , change constant of constrain programmatically when keyboard appears. tableview's frame resizes, contentsize not updating, why? how can force recalculate.

i have tried many approach.

nsnotificationcenter.defaultcenter().addobserverforname(uikeyboarddidshownotification, object: nil, queue:nsoperationqueue.mainqueue(), usingblock: {(notification: nsnotification?) -> () in      let keyboardsize = (notification!.userinfo![uikeyboardframebeginuserinfokey] as? nsvalue)!.cgrectvalue().size     self.bottomconstraint.constant = keyboardsize.height     self.view.layoutifneeded()      if let messagetableviewcontroller2 = messagetableviewcontroller, let messageviewsize2 = messageviewsize {          /*var frame = messagetableviewcontroller2.tableview.frame         frame.size.height = messageviewsize2.height - keyboardsize.height - 44         messagetableviewcontroller2.tableview.frame = frame*/          /*messagetableviewcontroller2.tableview.beginupdates()         messagetableviewcontroller2.tableview.layoutifneeded()         messagetableviewcontroller2.tableview.endupdates()          var frame = messagetableviewcontroller2.tableview.frame         frame.size.height = messagetableviewcontroller2.tableview.frame.size.height         messagetableviewcontroller2.tableview.frame = frame*/          /*let h = messagetableviewcontroller2.tableview.contentsize.height - keyboardsize.height + 44         println("messagetableviewcontroller2.tableview.contentsize: \(messagetableviewcontroller2.tableview.contentsize) h: \(h)")         messagetableviewcontroller2.tableview.contentsize = cgsizemake(messagetableviewcontroller2.tableview.contentsize.width, h)*/         /*messagetableviewcontroller2.tableview.setneedsupdateconstraints()         messagetableviewcontroller2.tableview.beginupdates()         messagetableviewcontroller2.tableview.endupdates()*/     } }) 

tableview.contentsize not change.

since update bottomconstraint of tableview. tableview.frame changed. contentsize property same.

tableview.contentsize updated, when cell in tableview change. example, insert, delete, reload.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -