Since upgrading to 10.9 Mavericks, I noticed that the content of all NSSearchfield
instances are misaligned: both the magnifying glass icon, the textfield itself and the clear button are moved down a little bit.
Any idea what could be the reason?
Since upgrading to 10.9 Mavericks, I noticed that the content of all NSSearchfield
instances are misaligned: both the magnifying glass icon, the textfield itself and the clear button are moved down a little bit.
Any idea what could be the reason?
I temporarily could fix it by subclassing NSSearchField
and choosing a custom class as cell class:
+ (void) load {
[super load];
[self setCellClass:[RMSearchFieldCell class]];
}
The RMSearchFieldCell
moves the origin of the cells +1 by overwriting the searchTextRectForBounds:
, searchButtonRectForBounds:
and cancelButtonRectForBounds:
methods:
- (NSRect) cancelButtonRectForBounds:(NSRect)rect {
NSRect superRect = [super cancelButtonRectForBounds:rect];
superRect.origin.y -=1;
return superRect;
}
However this is not the elegant way of doing it, and I'm still looking for the reason for the misalignment.