I'm trying to do this:

    CGSize imgSize = CGSizeMake(25.0f, 25.0f);
    UIGraphicsBeginImageContext(imgSize);
    
    NSString* s = [NSString stringWithFormat: @"%u", ga.stations.count];
    CGRect r = CGRectMake(0.0f, 0.0f, imgSize.width, imgSize.height);
    
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor);
    CGContextFillRect(ctx, r);
    
    [[UIColor whiteColor] set];
    UIFont* f = [UIFont fontWithName: @"Helvetica-Neue" size: 15.0f];
    CGSize ss = [s sizeWithFont: f];
    [s drawInRect: r withFont: f lineBreakMode: UILineBreakModeClip alignment: 
UITextAlignmentCenter];
    
    UIImage* img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

The reported size in "ss" is 0,0, and nothing draws. The red rectangle does 
draw, though.

I'm guessing UIKit routines can't be used in an image context, but I didn't see 
that spelled out in the method docs.

-- 
Rick

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to