I don't understand how to use delegates in Cocoa but I know what they are.
Posted
by lampShade
on Stack Overflow
See other posts from Stack Overflow
or by lampShade
Published on 2010-04-10T02:00:28Z
Indexed on
2010/04/10
2:03 UTC
Read the original article
Hit count: 389
Like many people I'm interested on Objective - C and Cocoa programming. I know conceptually what a delegate it is but I don't understand how to use them or when to use them. Here is some example code:
#import "AppControler.h"
@implementation AppControler
-(id)init
{
[super init];
NSLog(@"init");
speechSynth = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
//
[speechSynth setDelegate:self];
voiceList = [[/Applications/Google Chrome.app availableVoices] retain];
return self;
}
I'm setting the AppControler to be the delegate of the speechSynthasizer. Which means that the speechSynthasizer is telling hte AppControler what to do.
But I don't understand this line:
[speechSynth setDelegate:self];
© Stack Overflow or respective owner