IOS UITableView dynamically changing the height of Tableheaderview

Source: Internet
Author: User

Project needs to display some content at the top of the TableView, we can easily use Tableheaderview to achieve, but sometimes need to dynamically adjust the height of tableheaderview, we will find that even if the height of the header reset, frame, etc. , but the actual headerview height does not change, it can be seen that simply setting the header frame is useful for wood.

To change the height of a headerview dynamically, it's very simple:

UIView *headerview = _tableview.tableheaderview;
headerview.height = 0;
[_tableview beginupdates];
[_tableview settableheaderview:headerview];//Key is this sentence
[_tableview endupdates];

[_tableview beginupdates];
[_tableview endupdates];
These two words can make the transition have animation effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.