@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 <tony...@hotmail.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to