Monthly Archives: December 2005

Doing Web Services in Objective C

The examples for web services in Objective C in Xcode 2 are pretty lame. I am surprised that things are not cleaner – the WebKit is very sweet and cool.
I took one of the examples and refactored it to make it really cool. I will post code in the blog in my next two posts.
This is a mix of C++ and Objective C. I am not an expert in either in Xcode2 having learned Xcode 4 days ago. If someone smarter than me wants to redo this Apple event code using purely Objective C – that is fine with me. I would actually like that refactored code.
This is all Creative commons public domain – sample code stuff. Use, tear up reuse, don’t sue me.
This is the meat of host things are used again – note my weird dialect where I switch back form C, C++, and Objective C. I am still a newbie and fall back to things I know like fprintf from time to time :)

Continue reading

Doing a Modal Dialog in Objective C

See this URL:
http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingAppModalDialogs.html
This is a better modal dialog than in the Hillegass book pages 306-311. The Hillegass book is great showing the wiring of such a sheet – but the code below is better for the actual showing of the dialog. The Hillegass book uses the selector (nifty pet trick – but overkill for most modal dialogs).

Continue reading

The most Important things to Know in Xcode2

There are a few things are are *SOOO* subtle in Xcode. You need to know them of you will hate Xcode2. Thanks to my buddy Jeff Kahn and some good IM – I learned these tricks. Each thing easily has wasted several hours to a half day for me. But once you know them Xcode2 becomes more tolerable.
I am having fun with Objective C. I like the message pattern. It is fun to send messages to things. I worry a *lot* about memory leaks though.
On to the critical bits.

Continue reading

How does one Set the delegate value for an NSOutlineView in Interface Builder in Xcode 2

Sometimes these implicit interfaces are just too obtuse. I wasted a DAY figuring this out.
I needed to mark my class (SakaiDesktop) as a delegate for a NSOutlineView control on my window. I knew that it had something to do with dragging. The last step is what is missing.
Place Mouse over the Outline Control on the Window
Control-Drag from the Window to the instance of SakaiDesktop and release
The Inspector will switch to Outlets (this is what kept confusing me)
Switch *back* to Actions in the Inspector – delegate and datasource will be there – click on the row for delegate and the instance willbe the designated delegate.
Funny how this did not work:
[myOutline setDelegate:self];
When I did it in init.
The problem I had was without being set to the delegate, the
– (void)outlineViewSelectionDidChange:(NSNotification *)notification
Notifications were not being delivered.
If the people who built NIB builder just made it so that picking a delegate used a drop down list instead of this multi-click gymnastics, I would be much happier.