3
Mar
2008
 

Core Animation Tutorial: Wizard Dialog with Transitions

by Marcus Zarra

A question that I have seen pop up a few times is how to build a Wizard in Cocoa. Having thought about that question a bit I realized that a better answer to it is — how to build a wizard in Cocoa using Core Animation.

The basic concept behind this project is to present a window to the user that will walk them through a list of options. To accomplish this task, I created a number of NSViews that will be presented to the user in order so that they can make the decisions needed. To make this a little easier, I have extended NSView to create MSZLinkedView. The added functionality in this subclass is that the view has a reference to the previous and next views in the wizard. These references are set in interface builder directly so that I do not have to worry about them in code.

(more…)

 
1
Mar
2008
 

Does Objective-C Perform Autoboxing on Primitives?

by Marcus Zarra

This article is inaccurate.


The writer was smoking crack or something when he wrote it and has not been able to duplicate his tests since. This article is left here for historical reasons.

One of the things about Objective-C that I find extremely useful is the ability to resolve a method call at runtime. In addition this same functionality allows us to do some fairly creative things with callbacks, passing messages between threads, etc.

However there is a bit of a trick when it comes to passing primitives though some of these methods. For example, one method that I use quite frequently is performSelectorOnMainThread:withObject:waitUntilDone:. How exactly does one pass a BOOL or an int to this method?
(more…)

 
20
Feb
2008
 

Cocoa Coding Practice: Old School vs New

by Marcus Zarra

Garbage Collection

This post is in response to a few queries that I have received regarding my last post showing an NSOperation example. One of the questions raised that I will focus on is my -(void)dealloc method in the NSOperation subclass. The questions boiled down to:

Why are you using releases at all. Garbage collection is the future!

and

You should be just doing [self setVar:nil] instead of that [var release], var = nil; crap.

(more…)