I'm struggling with setNeedsDisplay
. I thought it was supposed to trigger calls of drawRect:
for the view for which it is called and the hierarchy below that if it's within the view's bounds, but I'm not finding that to be the case. Here is my setup:
From the application delegate, I create a view whose size is a square that covers essentially the whole screen real estate. This view is called TrollCalendarView
. There is not much that happens with TrollCalendarView
except for a rotation triggered by the compass.
There are 7 subviews of TrollCalendarView
called PlatformView
intended to contain 2D draw objects arranged around the center of TrollCalendarView
in a 7-sided arrangement. So when the iPad is rotated, these 7 views rotate such that they are always oriented with the cardinal directions.
Each of the PlatformView
subviews contains 3 subviews called Tower
. Each tower contains 2D draw objects implemented in drawRect:
.
So, in summary, I have TrollCalendarView
with empty drawRect:
, and subviews PlatformView
and Platformview
-> Tower that each have drawRect implementations. Additionally, Tower lies within the bounds of Platform, and Platform lies within the bounds of TrollCalendarView.
In TrollCalendarView
I've added a swipe recognizer. When I swipe happens, a property is updated, and I call [self setNeedsDisplay]
but nothing seems to happen. I added NSLog entries to drawRect:
method in each of these views, and only the TrollCalendarView
drawRect:
method is called. Ironically, that is the one view whose drawRect
method will be empty.
There is no xib file.
What do I need to do to ensure the drawRect
method in the other subviews is called? Is there documentation somewhere that describes all the nuances that could affect this?