Re: draw string with ellipsis
Re: draw string with ellipsis
- Subject: Re: draw string with ellipsis
- From: chaitanya pandit <email@hidden>
- Date: Mon, 28 Jul 2008 11:07:59 -0400
What u can do is get the actual size occupied by the string using
sizeWithAttributes:attrs and center it accordingly.
-Chaitanya
On 28-Jul-08, at 2:23 AM, Vitaly Ovchinnikov wrote:
Thanks, exactly what I need.
Btw, is there any easy way to center this line vertically? Or I need
to measure it's height and offset it vertically myself?
On Mon, Jul 28, 2008 at 9:57 AM, chaitanya pandit
<email@hidden> wrote:
Hi,
Heres what u can do,
NSString *stringToDraw; // the string to draw
NSMutableDictionary *attrs = [NSMutableDictionary
dictionaryWithCapacity:2];
NSMutableParagraphStyle *ps = [[[NSMutableParagraphStyle alloc] init]
autorelease];
[ps setLineBreakMode:NSLineBreakByTruncatingTail];
[attrs setObject:ps forKey:NSParagraphStyleAttributeName];
[stringToDraw drawInRect:rect withAttributes:attrs];
-Chaitanya
On 28-Jul-08, at 1:47 AM, Vitaly Ovchinnikov wrote:
Hello,
What should I pass to -drawInRect's attributes to draw NSString as a
single line with ellipsis at the end if it doesn't fit to the rect?
Or point me to another method that can do that.
Thank you.
_______________________________________________
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
_______________________________________________
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