The development of these days, there is a need to dynamically change the Tableviewheader interface, was directly in the viewdidload inside set a bit of tableviewheader=viewheader; Now assume that ViewHeader is the TableView head view)
Then after the data from the server, dynamically set the height of the viewheader, found that there is no effect ...
So let's briefly analyze:
ViewHeader as a tableview tableheaderview, simple to change the viewheader frame is useless, tableview will not be generous to the time to adapt to its height (after Apple will not change will not know), so , how to tell TableView its tableheaderview has changed. Very simple, just one word (key last sentence):
[WebView SizeToFit];
CGRect newframe = viewheader.frame;
NewFrame.size.height = NewFrame.size.height + webView.frame.size.height;
Viewheader.frame = Newframe;
[Self.tableview Settableheaderview:viewheader];
After that, the effect will come out. But this excessive appears some blunt, can add a little animation, let it become pleasing to some. Try the following code:
[Self.tableview beginupdates];
[Self.tableview Settableheaderview:viewheader];
[Self.tableview endupdates];
PS: Do you like my Jane book article, like, click on the attention bar .... Share a little bit of development