Using LocationManager from another class than Main

Posted by iphonePom on Stack Overflow See other posts from Stack Overflow or by iphonePom
Published on 2010-05-05T17:00:44Z Indexed on 2010/05/05 19:18 UTC
Read the original article Hit count: 204

Filed under:
|
|

Hi,

i'm new here, i'm new in iphone development, i'm new in Objective-c and i'm new in engligh speaking, so don't hate me :P

I'm creating an application that will use the location manager to display the distance between the own position and the positions of a list of shops, like AroundME.

Now, i give the locationManager property to my main class and in the .m of that class, precisely in the viewDidLoad method, i make: [locationManager startUpdatingLocation].

It all works fine, but the problem is: i need to know my position in other classes than the main, but i don't think that is a good idea making [locationManager startUpdatingLocation] every time i need it, is not time overhead?

The view of my main class is always below the others, so can i retrieve the updated location in my other classes? In what way?

Creating another instance of my main class is not useful, i think, but the locationManager, once started, doesn't stop until my main class is released, isn't true? So i think that it is accessible in some way.

Thanks for your attention and sorry for my awful english : )

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c