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

Positioning a string


  • Subject: Positioning a string
  • From: Julio Cesar Silva dos Santos <email@hidden>
  • Date: Mon, 30 Jan 2006 20:00:19 -0200

I am experiencing a little trouble with a string I want to draw in an NSRect and as the coordinates in Cocoa are upside-down I am totally confused. This string has a variable height but I want to put it always on the same point from the top of outerSize:

NSSize outerSize = [self bounds].size;
NSSize stringSize = [theString sizeWithAttributes:stringAttrib];
NSPoint stringPoint = NSMakePoint(fixedWidth, fixedHeight);
[theString drawAtPoint:stringPoint withAttributes:stringAttrib];

What is the calculation that I must do to get fixedHeight say, 32 pixels from top? I know, this is basic but I do not get it.

Thanks for any help,



Julio Cesar Santos
email@hidden
eMac 1GHz ComboDrive
640MB RAM
Linux User #359973


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Positioning a string
      • From: Ricky Sharp <email@hidden>
    • Re: Positioning a string
      • From: Andrew Thompson <email@hidden>
  • Prev by Date: News on "Cocoa Programming for Mac OS X"
  • Next by Date: Adding a button to a toolbar
  • Previous by thread: News on "Cocoa Programming for Mac OS X"
  • Next by thread: Re: Positioning a string
  • Index(es):
    • Date
    • Thread