setDelegate:self, how does it work?
- by fuzzygoat
I have a query regarding how delegates work. My understanding was that delegates take responsibility for doing certain tasks on behalf of another object.
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager startUpdatingLocation];
Am I right in thinking that in the example code above that the instance of CLLocationManager is created on a new thread so that it can get on with trying to find the location information it needs. When it completes its task (or encounters an error) it calls-back using the appropriate methods located in self e.g.
locationManager:didUpdateToLocation:fromLocation:
Essentially locationManager sends messages to self (which conforms to the correct delegate protocol) when things happen
cheers gary