One Quickie


Using a stretchable UIImage (Graphics->General)
Make an image somewhere (like in your -init):
        _timeIndicatorImage = [[[UIImage imageNamed: @"ride-profile-time-indicator"]
                                  stretchableImageWithLeftCapWidth: 0.0
                                  topCapHeight: 1.0] retain];
Then draw it. In this case it's a vertical indicator.
- (void) drawTimeIndicatorInRect: (CGRect) rect {
    CGFloat timeFraction = _time / _totalDuration;

    CGFloat x = [self horizontalPositionForTimeFraction: timeFraction];

    CGRect indicatorRect = CGRectMake (x, 0, 3.0, rect.size.height);
    [_timeIndicatorImage drawInRect: indicatorRect];

} // drawTimeIndicatorInRect



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com