Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to resize a tableHeaderView of a UITableView?
    primarykey
    data
    text
    <p>I'm having trouble resizing a tableHeaderView. It simple doesn't work.</p> <p>1) Create a UITableView and UIView (100 x 320 px);</p> <p>2) Set the UIView as tableHeaderView of the UITableView;</p> <p>3) Build and Go. Everything is ok.</p> <p>Now, I want to resizing the tableHeaderView, so I add this code in viewDidLoad:</p> <pre><code>self.tableView.autoresizesSubviews = YES; self.tableView.tableHeaderView = myHeaderView; self.tableView.tableFooterView = myFooterView; CGRect newFrame = self.tableView.tableHeaderView.frame; newFrame.size.height = newFrame.size.height + 100; self.tableView.tableHeaderView.frame = newFrame; </code></pre> <p>The height of the tableHeaderView should appear with 200, but appears with 100.</p> <p>If I write:</p> <pre><code>self.tableView.autoresizesSubviews = YES; CGRect newFrame = myHeaderView.frame; newFrame.size.height = newFrame.size.height + 100; myHeaderView.frame = newFrame; self.tableView.tableHeaderView = myHeaderView; self.tableView.tableFooterView = myFooterView; </code></pre> <p>Then it starts with 200 of height, as I want. But I want to be able to modify it in runtime.</p> <p>I've also tried this, without success:</p> <pre><code>self.tableView.autoresizesSubviews = YES; self.tableView.tableHeaderView = myHeaderView; self.tableView.tableFooterView = myFooterView; CGRect newFrame = self.tableView.tableHeaderView.frame; newFrame.size.height = newFrame.size.height + 100; self.tableView.tableHeaderView.frame = newFrame; [self.tableView.tableHeaderView setNeedsLayout]; [self.tableView.tableHeaderView setNeedsDisplay]; [self.tableView setNeedsLayout]; [self.tableView setNeedsDisplay]; </code></pre> <p>The point here is: <strong>How do we resize a tableHeaderView in runtime ???</strong></p> <p>Have anyone able to do this?</p> <p>Thanks</p> <p>iMe</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload