0

I have implemented a subclassed version of NSTextField, which I've called CustomTextField, the code for which is below:

@interface CustomTextField : NSTextField

@property (nonatomic, strong) IBInspectable NSImage *backgroundImage;

@end

@implementation CustomTextField

- (void)awakeFromNib
{
    [self setDrawsBackground:NO];

}

- (void)drawRect:(NSRect)rect
{
    NSImage *backgroundImage = self.backgroundImage;

    [backgroundImage drawInRect:rect fromRect:rect operation:NSCompositeSourceOver fraction:1.0];

    [super drawRect:rect];
}

@end

I have three instances of this custom text field, which I've set-up in my XIB file. When I run the app, select a text field, type in some text, and hit 'Enter', I get the following output from Xcode:

malloc: protecting edges
malloc: enabling scribbling to detect mods to free blocks
malloc: nano zone does not support guard pages
malloc: purgeable zone does not support guard pages

My guess is that my subclass implementation is not handling something correctly, but I'm honestly not sure. Does anyone have some suggestions? Thanks!

narner
  • 2,908
  • 3
  • 26
  • 63
  • 1
    http://stackoverflow.com/questions/6429849/debugging-malloc-purgeable-zone-does-not-support-guard-pages-with-xcode – Kreiri Jul 09 '15 at 15:41

1 Answers1

1

You should call

[super awakeFromNib];

in your awakeFromNib method.

From the docs:

You must call the super implementation of awakeFromNib to give parent classes the opportunity to perform any additional initialization they require. Although the default implementation of this method does nothing, many UIKit classes provide non-empty implementations. You may call the super implementation at any point during your own awakeFromNib method.

Nicolas Buquet
  • 3,880
  • 28
  • 28
  • Thank you for the suggestion...I gave that a shot, but it looks like I'm still getting those warnings. – narner Jul 09 '15 at 16:50