2009-07-03 11 views
0

Ich bin seit Tagen auf diesem festgefahren und habe mich gefragt, ob jemand irgendwelche Hinweise hatte? Sollte einfach sein, aber es hat mich festgefahren! Ich bekomme meinen Standort und fahre fort. Aber ich möchte IN DIESER METHODE - LOOPING - bleiben, bis ich einen gültigen Ort bekomme. Dann Ladeansicht. DANKE für irgendwelche Tipps!loadview NUR, wenn ich meine GPS-Position bekomme

Ich bin mit dem Standard:

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

    return self; 
} 



- (void)viewDidLoad 
{ 


// do my processing here ONLY when I get a valid location*************************** 
// and if I never get a valid location, then just go to my last location. 



} 



(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation 
{ 
    NSDate* eventDate = newLocation.timestamp; 
    NSTimeInterval howRecent = [eventDate timeIntervalSinceNow]; 

    if (abs(howRecent) < 5.0) 

    { 

     [manager stopUpdatingLocation] 

     printf("latitude %+.6f, longitude %+.6f\n", newLocation.coordinate.latitude, newLocation.coordinate.longitude); 

    } 


} 

Antwort

3

vielmehr in Ihrem viewDidLoad als Spinnen, wie etwa eine temporäre Ansicht setzen, bis Sie Ihre GPS-Position haben?

Ihre Ansicht wird immer noch unter dem Startbildschirm warten, aber niemand kann damit interagieren, bis Sie bereit sind.

Verwandte Themen