简体   繁体   English

从UITableView标头视图中删除子视图

[英]Removing subview from UITableView header view

My iOS apps shows a UITableView with a tableHeaderView containing 3 subviews (A,B and C). 我的iOS应用程序显示一个UITableView及其一个tableHeaderView,其中包含3个子视图(A,B和C)。


| | A | A |

| | B | B |

| | C | C |

| | cell1 | cell1 |

| | cell2 | cell2 |

| | cell3 | cell3 |

| | ... | ... |

The problem is that when I remove C using: 问题是当我使用以下命令删除C时:

[C removeFromSuperview]

I have a white gap left that I would like to remove too in order the tableview to be attached directly to B. I tried resizing the whole tableHeaderView and tweaking the AutoresizingMask,but with no luck. 我还有一个空白需要删除,以便将tableview直接附加到B。我尝试调整整个tableHeaderView的大小并调整AutoresizingMask,但是没有运气。

Any suggestion? 有什么建议吗?

It sounds like you need to tell the table to resize the header view. 听起来您需要告诉表调整标题视图的大小。 Just setting the tableHeaderView works for me 只需设置tableHeaderView对我有用

tableView.tableHeaderView = tableView.tableHeaderView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM