Graphics Reference
In-Depth Information
LISTING 4-4
Continued
target : self
selector : @selector (legTwo:)
userInfo : nil
repeats : NO ];
[ NSTimer scheduledTimerWithTimeInterval :6.0
target : self
selector : @selector (legThree:)
userInfo : nil
repeats : NO ];
[ NSTimer scheduledTimerWithTimeInterval :8.0
target : self
selector : @selector (legFour:)
userInfo : nil
repeats : NO ];
[ NSTimer scheduledTimerWithTimeInterval :10.0
target : self
selector : @selector (legFive:)
userInfo : nil
repeats : NO ];
// Tell the root layer to call drawLayer
[[[window contentView ] layer ] setNeedsDisplay ];
}
As each time is reached, another point is added to the starPath path, and the root layer
updates its display, as shown in Listing 4-5. The final call, legFive , closes the path.
LISTING 4-5
Selector Methods for Each Timer Add a New Point to the Path
- ( void )legOne:( id )sender
{
CGPathAddLineToPoint (starPath, NULL , 181.0, 99.0);
[[[window contentView ] layer ] setNeedsDisplay ];
}
- ( void )legTwo:( id )sender
{
CGPathAddLineToPoint (starPath, NULL , 335.0, 210.0);
[[[window contentView] layer] setNeedsDisplay];
}
 
Search WWH ::




Custom Search