Let me elaborate a little bit on this kind of issue that I'm sure many other developers that are learning iOS encountered or will encounter.
Basically whenever you are doing some basic UI change like background color, text color etc, or other UI changes that don't require heavy computation and the UI doesn't get updated you will have to check two things first (besides the correctness of the code that changes the UI).
Is your UI freezing when you try to update/change something ?
If your UI doesn't freeze, does it update at all, or is the code executed ?
If the first point is happening than obviously you are doing to much work on the main thread and you have to move the heavy work on a background thread.
If the second point is happening than there might be two causes. First your code is wrong and it's never called or the code is called on a background thread.
In order to determine if your code is executed on a background thread, simply put a breakpoint where you are updating the code and check the debug navigator to see the thread number, if it's not main thread, then make it on main thread.
The second way to find out if your code is on background thread is....surprise....an ugly crash.
Also a very offen problem of UI code executed on background is using NSNotification
to update the UI. Rule of thumb: NSNotification
is posted on the same thread as the caller.