BuySellAds.com

Until Dec 3rd, 44% off all Manning books, including Barcodes with iOS! Promo code: mobicftw
Our DNA is written in Objective-C
Jump

Radar: NSTextField Redrawing of Background With Layer-Backing

I noticed this bug in NSTextField already back last year but I procrastinated until I saw it the second time in the second Mac app I am building. I did have a workaround for the bug, so it was not that pressing.

But I guess we should consider it our duty as Mac developers to make sure that Apple knows about bugs for this platform. So finally here’s my Radar for it. rdar://13006140

NSTextField Redrawing of Background With Layer-Backing

Summary

When used as subview of a view that has layer-backing turned on then making it wider causes the background color to not fill the entire area of the control.

I am seeing this bug in a scenario where I have a text field in an inspector panel that I can change in width via an NSSplitView. I attached a screen shot of the bug how it appears on an empty text field without the workaround mentioned below.

Screen Shot 2013-01-14 at 11.27.58 AM

Steps to Reproduce

  • have an NSView that has layer-backing turned on
  • add an NSTextField as a subview to that
  • have layout constraints that fix the left and right margin between the text field and the superview
  • enlarge the NSView

Expected Results

  • the background color of the control should be filled consistently
  • the amount of text in the textfield seems to play a role. If it is empty then the unfilled background stays. If not then it might get filled once the user release the mouse button

Actual Results

Only the part of the control that was visible before stays filled, the new space appearing on the right side does not have background filling

Regression

Only occurs in connection with layers.

Notes

As workaround I subclassed NSTextField and overwrite drawRect like this:

- (void)drawRect:(NSRect)dirtyRect
{
	[super drawRect:self.bounds];
}

This fixes the problem because the dirtyRect is too small.


Categories: Bug Reports

%d bloggers like this: