SetNeedsDisplay does not call drawRect in subtitles as expected

I am struggling with setNeedsDisplay. I thought that he should have called the calls drawRect:for the view for which he is called, and the hierarchy below, if he is within the bounds of the view, but I do not find it to be so. Here is my setup:

From the application delegate, I create a view whose size is a square that covers essentially all the real estate on the screen. This species is called TrollCalendarView. There is not much that happens with TrollCalendarViewthe exception of rotation caused by the compass.

There are 7 sub TrollCalendarView- points , called PlatformView, intended for placement of 2D drawing objects located around the center TrollCalendarViewin a 7-sided arrangement. Therefore, when the iPad rotates, these 7 views rotate so that they are always oriented with cardinal directions.

Each of the subframes PlatformViewcontains 3 subsets called Tower. Each tower contains 2D drawing objects implemented in drawRect:.

So, in general, I have TrollCalendarViewwith empty drawRect:, and subviews PlatformViewand PlatformView→ Tower, each of which has drawRect implementations. In addition, the Tower is within the platform, and the platform lies within the TrollCalendarView.

In TrollCalendarViewI added a napkin recognizer. When I make napkins, the property is updated, and I call [self setNeedsDisplay], but nothing happens. I added NSLog entries to the method drawRect:in each of these views and only the method is TrollCalendarView drawRect:called. Oddly enough, this is the only view, the method drawRectwill be empty.

There is no xib file.

What do I need to do to provide a method drawRectin other subviews? Is there somewhere documentation describing all the nuances that could affect this?

+5
source share
2 answers

I am struggling with setNeedsDisplay. I thought that he should have called drawRect calls for the view for which he is being called, and the hierarchy below if he is within the bounds of the view

, . ?

-setNeedsDisplay: , . , -setNeedsDisplay: . , .

+7

, ; , . , - drawrect (, ..).

, ( ), setNeedsDisplay :

-(void) setNeedsDisplay {
    [self.subviews makeObjectsPerformSelector:@selector(setNeedsDisplay)];
    [super setNeedsDisplay];
}

, . , , - , , ... , , .: -)

+5

All Articles