• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [SOLVED] -[drawInRect:withFont:] in Image Context?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED] -[drawInRect:withFont:] in Image Context?


  • Subject: Re: [SOLVED] -[drawInRect:withFont:] in Image Context?
  • From: Rick Mann <email@hidden>
  • Date: Tue, 24 May 2011 18:05:35 -0700

Ugh. My font was bad. Sorry for the noise.

On May 24, 2011, at 17:58 , Rick Mann wrote:

> 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@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

_______________________________________________

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

References: 
 >-[drawInRect:withFont:] in Image Context? (From: Rick Mann <email@hidden>)

  • Prev by Date: -[drawInRect:withFont:] in Image Context?
  • Next by Date: Cocoa Developer (full time position) at Box (New York, USA)
  • Previous by thread: -[drawInRect:withFont:] in Image Context?
  • Next by thread: brushing up my skills/knowledge
  • Index(es):
    • Date
    • Thread