• 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
NSStringDrawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSStringDrawing


  • Subject: NSStringDrawing
  • From: MF <email@hidden>
  • Date: Thu, 14 Aug 2008 17:31:41 +0200

Hello!

I tried to draw strings in the center of a rectangle. While it's alright to
execute the code, and the font is correctly shown, the alignment is wrong.
(still on the left side...)


the following is the codes for drawing the string. Does anyone know what's
wrong with it? or simply drawing string doesn't support alignment?


NSFont *font = [[[NSFont fontWithName:@"Verdana" size:12.0] retain]
autorelease];

NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];

[style setAlignment:NSCenterTextAlignment];

NSDictionary *attrsDictionary =

[NSDictionary dictionaryWithObjectsAndKeys: font, NSFontAttributeName,
style,NSFontAttributeName,nil];

[style release];

[name drawInRect:aRect withAttributes:attrsDictionary];


Thanks a lot!
_______________________________________________

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

  • Follow-Ups:
    • Re: NSStringDrawing
      • From: "Sherm Pendley" <email@hidden>
  • Prev by Date: Re: @try @catch
  • Next by Date: Re: NSStringDrawing
  • Previous by thread: Re: crashing MacOs application when running a build file
  • Next by thread: Re: NSStringDrawing
  • Index(es):
    • Date
    • Thread