Question about Apple's updated Sketch-112 program
Question about Apple's updated Sketch-112 program
- Subject: Question about Apple's updated Sketch-112 program
- From: Michael de Haan <email@hidden>
- Date: Wed, 14 Oct 2009 06:44:48 -0700
Hi All,
I think this is an easy issue...for those with more knowledge than
I :) but it has had me stumped for a while now.
I am puzzled about one of the calls (the "invalidateGraphic method")
of the setter of the NSArray (_graphics) in the document.m file. The
sequence occurs when data is read from an (archived) saved file. The
sequence, I believe, goes like this.
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:
(NSError **)outError {
....set up stuff.......
[self setGraphics:graphics];
Which calls:
- (void)setGraphics:(NSArray *)graphics {
unsigned i = [_graphics count];
while (i-- > 0) {
[self removeGraphicAtIndex:i];
}
i = [graphics count];
while (i-- > 0) {
[self insertGraphic:[graphics objectAtIndex:i] atIndex:0];
}
}
which calls
- (void)insertGraphic:(SKTGraphic *)graphic atIndex:(unsigned)index {
[[[self undoManager] prepareWithInvocationTarget:self]
removeGraphicAtIndex:index];
[_graphics insertObject:graphic atIndex:index];
[graphic setDocument:self];
[self invalidateGraphic:graphic];
and the part that I do not get:
- (void)invalidateGraphic:(SKTGraphic *)graphic {
NSArray *windowControllers = [self windowControllers];
[windowControllers makeObjectsPerformSelector:@selector
(invalidateGraphic:) withObject:graphic];}
I **think** I see what each line is doing, but, fail to grasp the
overall essence of the call.
Thanks in advance.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden