UITableView duplicate cells, half of which are hidden

andy.w's Avatar

andy.w

19 Apr, 2017 03:56 PM

Using Reveal to look at a UITableView in my app, and it is showing that after scrolling there are sometimes duplicate cells in the UITableView.

They are exactly the same construction, and have separate addresses in memory, but one of each pair is always hidden.

Unsure if this is an issue with my code, and something to do with a cell being accidentally recreated when being dequeued, or if this is a 'behind the scenes' mechanism that UITableView uses to handle dequeuing and scrolling.

Any ideas?

  1. Support Staff 1 Posted by Vlas Voloshin on 20 Apr, 2017 02:28 PM

    Vlas Voloshin's Avatar

    Hi Andy,

    The behaviour you've described is more or less normal. UITableView and UICollectionView implement cell reuse by hiding the cell views that have been "discarded", until they are claimed by the data source again. Depending on the way you use your table view, you may end up with quite a few unused cells which look "duplicated". This is not indicative of any particular problem in your code (or in Reveal), though it may give you a hint about cell reuse efficiency, table reloading or dynamic sizing overhead.

    Remember: you can always toggle displaying hidden views in Reveal using CanvasDisplay Hidden Views menu item, or the corresponding button in the bottom-left corner of the Canvas.

    Best regards,
    Vlas.

  2. Vlas Voloshin closed this discussion on 20 Apr, 2017 02:28 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac