PyPiePi PyPiePi - 1 year ago 115
Swift Question

Large Gap Between Cells in UITableView, iOS Bug?

Anyone up for an interesting UI challenge? If so, you've come to the right place! I have a

in Swift, with self-resizing cells (they use
as opposed to the
function). You can see from my screenshots that there is an odd gap in between the cells, and if you look at the screenshot of the UI capture, you can see that the problem is probably not that the cells are laying out wrong, there is actually no table view cell in the space. The wholes tend to jump around somewhat randomly when I start searching in the search bar, but often go away all together when I set a sort (using the filter scope selector that is attached to the search bar, shown in the second image).

As a HS student developer, I really, really appreciate any help you can give me with this! Although I wouldn't call myself a beginner at iOS, I am certainly no veteran at dealing with UIs.

Ur the best Stack Overflow community!

Gap While Searching
UI Capture from <code>Xcode</code>

Answer Source

So, this is horrible, but it just "magically" fixed itself. The only possible explanation is that it was fixed because of the sketchy-ish code I added to get the sort/filter selection buttons to always show.

    searchController.searchBar.showsScopeBar = true
    searchController.searchBar.frame = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.size.width, height: 88)

It was happening all the way up until I added that line. If anyone can explain exactly why this fixed it, that would be cool. I have a couple of ideas, but I'm really not sure.

It ended well at least.

Pura Vida

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download