简体   繁体   中英

I've added a view within a UITableView and there is a gap between the view and the first cell. How can I remove it?

I've added a view to a tableView and there is a gap between the view which is 44px high and the first cell.

Here's a screen shot from IB:

在此处输入图片说明

I've tried a few things such as changing the heightForHeaderInSection's value and also disabled adjust scroll view insets. None of these work properly. The view seems to be within the tableView and scrolls with it.

This is how things are looking in simulator:

在此处输入图片说明

Would appreciate some help here as I don't understand what exactly is causing this gap.

Thanks for your time

A great way to debug these types of problems is to set a background color. You could set the cells to red and the view to green. It would then be interesting to see if the red and green edges are flush with no white in between.

Based on your screenshot, it looks like nothing is wrong. And by that I mean it looks about right for a view height of 44 points and a cell immediately beneath it with no separator line above it (so it's hard to tell where one ends and the other begins).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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