开发者

Core Location question

开发者 https://www.devze.com 2022-12-26 16:39 出处:网络
This tutorial on mobileorchard.com uses 2 classes (or 2 sets of .h and .m) to implement core location. Can I just use everything there in my existing class? How would I do that?

This tutorial on mobileorchard.com uses 2 classes (or 2 sets of .h and .m) to implement core location. Can I just use everything there in my existing class? How would I do that?

Can I use my existing app delegate as a location delegate as well?

Also, is the

- (id) init {
    self = [super init];
    if (self != nil) {
        self.locationManager = [[[CLLocationManager alloc] init] autorelease];
        self.locationManager.delegate = self; // send loc updates to myself
    }
    return self;
}

method the same as the usual initWithNib?

I'm trying to quickly implement something based on location information. As much help de开发者_运维百科scribing the above linked tutorial would be helpful.

Thanks. No - really, Thank You.


Yes, sure. You can make your delegate a location manager delegate too. You'll just need to implement CLLocationManagerDelegate there with the method:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

to get location updates.

0

精彩评论

暂无评论...
验证码 换一张
取 消