Well… this should be obvious, but what does “dequeueReusableCellWithIdentifier” mean? More or less it means each cell can be REUSABLE. Yesterday I was working on new Track My TV version and found strange bug – I have UITableView which has subclassed UITableViewCell. And in cellForRowAtIndexPath I’m just filling all data as usual. But my list had ca. 20 series and when I scroll down and up, some labels were disappearing. First I started to look at constraints – my first idea was “something is wrong with them”. But I wasted 2 hours without any result. Today I started from opposite side – commented out almost whole cellForRowAtIndexPath content, and labels were not disappearing. After few minutes I found the reason – I had something like this:

seems to be ok, but what happens when episode has no date? Well, its just hidden so no date is shown. And what happens if I scroll up again? Yes, its still hidden no matter if date is present. So solution was very simple:

placed before “if” helped. So what does it mean? Cells are really REUSABLE. Keep that in mind and clear everything you don’t want to show.

In some cases, when you are using UITableView with UISearchBar you don’t want to filter you view immediately – f.e. when you’re fetching result from remote source, to achieve this, add UISearchBarDelegate to your view controller and just overload: