Re: Interface Builder Plugin Dependency
Re: Interface Builder Plugin Dependency
- Subject: Re: Interface Builder Plugin Dependency
- From: Bridger Maxwell <email@hidden>
- Date: Thu, 29 Jan 2009 16:54:38 -0700
It turns out the error is completely different from what I thought it was
(isn't it always?). It turns out Xcode was omitting part of the output from
IBTool. When I tried to compile my xib from Terminal, I got this error:
Description: ibtool encountered an error while loading the ibplugin from
/Users/bridger/Development/Mercury/MercuryStation/build/Debug/SCMercury.framework/Versions/A/Resources/SCThemes.ibplugin.
Error: Error Domain=com.apple.InterfaceBuilder Code=-1 UserInfo=0x6e9e90
"Interface Builder could not load the 'Themes' plug-in because an exception
was raised.
Exception name: NSInternalInconsistencyException
Reason: Error (1002) creating CGSWindow"
I Googled around a bit, and I know it has something to do with drawing. In
fact, I have narrowed it down to these lines of code:
NSImage * canvas = [[NSImage alloc] initWithSize: canvas_size];
[canvas lockFocus];
...
[canvas unlockFocus];
This is a vital part of my plugin though. I use this in an NSImage category
which crops an NSImage. Why does lockFocus cause IB compilation errors, and
can how can I fix it?
Also, here is the NSImage category in its entirety. I actually took it from
someone else on this list a while back.
- (NSImage *) imageFromRect: (NSRect) rect
{
NSAffineTransform * xform = [NSAffineTransform transform];
// translate reference frame to map rectangle 'rect' into first
quadrant
[xform translateXBy: -rect.origin.x
yBy: -rect.origin.y];
NSSize canvas_size = [xform transformSize: rect.size];
NSImage * canvas = [[NSImage alloc] initWithSize: canvas_size];
[canvas lockFocus];
[xform concat];
// Get NSImageRep of image
NSImageRep * rep = [self bestRepresentationForDevice: nil];
[rep drawAtPoint: NSZeroPoint];
[canvas unlockFocus];
return [canvas autorelease];
return nil;
}
Thank You,
Bridger Maxwell
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden