Re: CustomView Help ...
Re: CustomView Help ...
- Subject: Re: CustomView Help ...
- From: Mic Pringle <email@hidden>
- Date: 14 Mar 2008 11:21:40 +0000
- Authenticated-sender:
Hi Kyle,
Thanks for the tip-off with the docs, will defo look into this.
Although having scanned through them, I cannot see how you set the font,
size, color etc or how to use -sizeWithAttributes to keep it centered ?
Is there an example you know of that I can look at ?
Thanks
-Mic
On Mar 14 2008, Kyle Sluder wrote:
On 14 Mar 2008 11:07:55 +0000, Mic Pringle <email@hidden>
wrote:
I just dragged the label icon from the palette in IB onto my custom
view ?
Ditch the NSTextField that you're currently using (that's what the
"label" is) and do the drawing yourself. AppKit does not support
overlapping views. Since you're tying the color of the view/text to
the drag operation, which happens in a separate runloop mode, you will
have more consistent results this way.
AppKit adds -drawWithRect:options:attributes to NSString in a category.
(See
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSString_AppKitAdditions/Reference/Reference.html
for documentation.) You want to use this in concert with
-sizeWithAttributes: to draw the string centered in your view.
HTH,
--Kyle Sluder
_______________________________________________
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