10
10

More than 5 years have passed since last update.

UITableView.tableHeaderView の高さを変更する

Last updated at Posted at 2012-12-26

UITableView.tableHeaderView の高さを変更するには、tableHeaderView を再設定する必要がある。

self.tableView.tableHeaderView.frame = rect;
self.tableView.tableHeaderView = self.tableView.tableHeaderView; // ★コレ

UITableView.tableHeaderView の高さをアニメーションつきで変更するには以下のようにする:

[UIView animateWithDuration:0.3
                         animations:^{
                             self.tableView.tableHeaderView.frame = newFrame;
                             self.tableView.tableHeaderView.frame = self.tableView.tableHeaderView.frame; // ★コレ
                         }
                         completion:^(BOOL finished) {}];

たぶん tableFooterView も同様のやり方で対応できる。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10