ios - Where to set and layout a TableView footer -
I am trying to add a footer to my table view. The problem I have is:
If I set the footer in viewWillLayoutSubviews , then due to this it will be called
viewWillLayoutSubviews and we will call an infinite loop .
Instead I set the footer in the
viewDidLoad and calculate it and its subviews frame in
viewWillLayoutSubviews , the footer at the top Ends my first part of the table view is covered.
I can not calculate the frame in the
viewDidLoad because the table view limit is not correct (My app only supports landscape mode).
I can create and layout the footer in
viewWillLayoutSubviews by using a Boolean instance variable, but only when it is called for the first time, but it seems incorrect Then the frames will not be counted again. There should be a better way.
Just create them in viewDidLoad and assign tableViewHeader and tableViewFooter properties, in that way the tableview will handle their position.
Comments
Post a Comment