Re: CATextLayer metrics
Re: CATextLayer metrics
- Subject: Re: CATextLayer metrics
- From: Bill Dudney <email@hidden>
- Date: Thu, 28 Feb 2008 20:47:26 -0700
Hi Karl,
Have you tried the preferredFrameSize method? I have had success in
doing simple text sizing with this method ( by simple i mean that i've
done labels and such). It won't tell you the # of lines but it will
give you a frame size.
HTH,
-bd-
http://bill.dudney.net/roller/objc
On Feb 28, 2008, at 1:25 PM, Karl Goiser wrote:
Hello Cocoa people,
With traditional Cocoa text drawing, it is possible to determine the
size of a piece of text ahead of time with methods like NSString's
sizeWithAttributes: or with NSCell's cellSizeForBounds:. These
methods allow the determination of the width of some text, or the
number of lines the text would require given a particular width.
But how is it possible to determine these things for a CATextLayer?
That is, and as a specific question: given a CATextLayer with some
text and font specifications, and a fixed width, how can I determine
the number of lines it would require?
Is part of the answer the CATextLayer's bounds, and is this set up
correctly before calling its preferredFrameSize method? However,
this doesn't provide the actual number of lines the text would take.
Do you know how to determine the number of lines in a CATextLayer?
Thank you in advance!
Karl
_______________________________________________
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