Thanks for showing your code.
At a glance I cannot find any suspicious codings which may cause changes UI for every fifth cell.
I will take some time to run your code. Any additional info which helps testing your code would be welcome.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: