Re: Newbie: applescript "call method" to obj-c method (booleans & image data)
Re: Newbie: applescript "call method" to obj-c method (booleans & image data)
- Subject: Re: Newbie: applescript "call method" to obj-c method (booleans & image data)
- From: Graham Cox <email@hidden>
- Date: Sun, 15 Jun 2008 02:17:19 +1000
On 15 Jun 2008, at 2:08 am, Loren Ryter wrote:
WithSticky:(BOOL *)aStick WithClick:(NSString *)aClick
BOOL* means "pointer to BOOL" not BOOL itself. So you need to remove
the *. The same doesn't apply to NSNumber because NSNumber is an
object (objects are always passed by pointer). If you wanted to use an
NSNumber (there's no real reason to here though) you can extract the
actual bool using -[number boolValue];
iconData:[NSImage initWithContentsOfFile:aPath]
should be iconData:[[[NSImage alloc] initWithContentsOfFile:path]
autorelease]
there are two kinds of methods - class methods and instance methods.
Class methods can be sent like [NSImage ...], but instance methods
have to be sent to an actual object. In the headers, the two kinds of
methods are distinguished by the + and - signs in front of them, + for
class methods, - for instance methods. Because -
initWithContentsOfFile: is an instance method, you have to alloc an
instance and then arrange for it to be released later - which is what
the corrected line above does.
hth,
Graham
_______________________________________________
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