Ramblings of a techie

Archive for December, 2014

It was a late night on the 25th and when I got up quite early the 26th to some inspiration for coding I added a UITableView like I did so many times before. I added the source and thought all was fine. But it didn’t work. It didn’t show anything.

First I decided to view.SetNeedsDisplay() and that actually then did show the table, but without any data. Just a BackgroundColor rectangle. At least now it had BackgroundColor and not white (the color of Superview.BackgroundColor).

But the table wouldn’t scroll and you could not select any rows; this, in my tired mind, made an alarm go off. I did this so many times before and it always worked, this time it didn’t and all stackoverflow answers where based on mistakes I had not made for a long time, so it must be another mistake.

It took me 1 hour to figure out what was going on as I did not know that tableviews who do not receive inputs do not get refreshed which is related to the UIViews which receive no inputs not getting they LayoutSubviews() called.

Long story short; the UITableView was in a UIView which was not big enough and ClipToBounds was false, so it did show up but nothing else. My overlapping tools and debugging tools did not detect this, so I lost any hour.

In my library I have all Apple view classes inherited by my own for tooling, debugging and convenience methods, so it was not hard to fix this once and for all by overriding Frame{get;set;} and, for DEBUG add the following which warns me and makes sure I actually checked everything (ShowStack is an Extension which allows me to see the linenumber + file name the issue happens to be appear in);