From: Charles S. <bas...@ch...> - 2012-06-18 21:38:40
|
On Jun 18, 2012, at 4:24 PM, Charles Srstka wrote: > On Jun 18, 2012, at 4:13 PM, Robert Munafo wrote: > >> I have Xcode 3.2.6 on both of my Snow Leopard machines, but I'll need >> instructions on how to create the project and where to put the missing >> main() routine, and/or how to compile it from the command line with >> /usr/bin/xcodebuild. >> >> I tried making a new project from templates "Cocoa Application" and >> "Quick Look Plug-In", but your code doesn't seem to fit into either of >> those. >> >> (Anyone else aside from Charles, feel free to clue me in. I don't mind >> looking foolish :-) > > You just paste it into the Document-Based Application template. Then, you put an NSImageView in the .xib file and bind it to the “image” property on File’s Owner, and put in a button, menu item, whatever you please, and bind it to -convertToTIFF: either on File’s Owner or on First Responder. > > However, the snippet I posted was ARC, which Xcode 3 doesn’t support, so you’ll want to stick a release after assigning self.image, in order to avoid a memory leak. I should have thought of that, since you already mentioned you were on Snow Leopard. Sorry about that. Oh, one other change you’ll have to make for Xcode 3 is to stick a declaration for the -convertToTIFF: method in the header file; otherwise Interface Builder probably won’t see it. As for main(), there’s rarely anything in there in a Cocoa app. Typically it’s just one line that calls NSApplicationMain() and returns the result. The framework handles all the actual initialization stuff. Charles |