Re: drawingRectForBounds not being called
Re: drawingRectForBounds not being called
- Subject: Re: drawingRectForBounds not being called
- From: Tony Romano <email@hidden>
- Date: Sat, 31 Jul 2010 08:31:14 -0700
Here is one additional thing I discovered. I have an outlet to the NSTextField that contains the cell so I can write text to it. This is the only connection to my application. If I remove the outlet, the drawingRectForBounds: is called. If I add it back, it won't get called. Why should having an outlet to the control have any affect on this method getting called. Something weird is going on.
-Tony
On Jul 30, 2010, at 4:05 PM, Tony Romano wrote:
> @interface ViewStatusTextCell : NSTextFieldCell
>
> - (NSRect)drawingRectForBounds:(NSRect)theRect;
>
> @end
>
> - (NSRect)drawingRectForBounds:(NSRect)theRect
> {
> NSRect rect = [super drawingRectForBounds:theRect];
> NSSize textSize = [self cellSizeForBounds:theRect];
>
> NSUInteger heightDelta = rect.size.height - textSize.height;
> if (heightDelta > 0) {
> rect.size.height -= heightDelta;
> rect.origin.y += heightDelta/2;
> }
>
> return rect;
> }
>
> On Jul 30, 2010, at 4:03 PM, Kyle Sluder wrote:
>
>> On Fri, Jul 30, 2010 at 3:38 PM, Tony Romano <email@hidden> wrote:
>>> I have an NSTextTextField in my nib that is using a custom NSTextFieldCell (set in IB) class that has only one method over-riden, drawingRectForBounds. The method is not being called. This is what I have done.
>>>
>>> 1. Set a break point to verify it is not being called.
>>> 2. Using F-Script, verified that the instance of NSTextField is using my custom cell. I can invoke my method via F-Script as well.
>>> 3. Verified the correct spelling and signature of the method.
>>
>> Are you certain? The method is named -drawingRectForBounds:. Since you
>> omitted the colon above, I am wondering if you have in fact misspelled
>> the method.
>>
>> Please post your code.
>>
>> --Kyle Sluder
>>
>
> -Tony
>
> _______________________________________________
>
> 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
>
-Tony
_______________________________________________
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