Reputation: 4176
I'm looking for a minimal viable example here. I've been googleing and reading up for days now and I can't find a single resource that is up to date.
My NSControl works ok, but as soon as I add
+ (Class)cellClass {
return [MYCustomCell class];
}
to it I get this output and my window stops to draw properly
<Error>: kCGErrorFailure: CGSShapeWindow
<Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_NXPlaceWindow: error setting window shape (1000)
<Error>: kCGErrorFailure: CGSShapeWindow
_NSShapeRoundedWindowWithWeighting: error setting window shape (1000)
I've read everything I could find about this subject (including the Apple docs), but everything seems far to vague to come to a proper implementation. I would really appreciate it if somebody could point me in the right direction (proper code example or article).
Upvotes: 1
Views: 835
Reputation: 142
I believe I have finally found the answer.
The -cellSize method must be overridden in your NSCell/NSActionCell subclass. After gobs of stack tracing I discovered that this method will return (40000, 40000) as your cell size if it is not overridden thus creating the sizing errors that we have seen. Since I have special needs in my NSActionCell subclass that require the cell to occupy the entire NSControl's drawing area I simply used the following.
- (NSSize)cellSize {
return self.controlView.bounds.size;
}
Hope this helps your situation.
Upvotes: 4