2009-07-03 3 views
0

나는 이것에 며칠 동안 갇혀 있었고 누군가가 단서를 가지고 있는지 궁금해하고 있었습니까? 간단해야하지만, 내가 붙어있다! 내 위치를 얻은 다음 계속합니다. 그러나 나는 유효한 위치를 얻을 때까지 그 방법 - 루핑 -에 머물고 싶습니다. 그런 다음 loadview. 어떤 조언을 주셔서 감사합니다! 당신의 viewDidLoad에서loadview 내 GPS 위치를 얻을 때만

- (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); 

    } 


} 

답변

3

보다는 회전하는 방법 당신이 당신의 GPS 위치를 때까지 임시 뷰를 올리는 약 :

나는 표준을 사용하고?

// custom full-screen view class of your choice 
// could just be a UIImageView if you wanted 
SplashOverlay *splash; 

- (void)viewDidLoad { 
    [super viewDidLoad]; 

    splash = [[SplashOverlay alloc] initWithNibName:@"SplashOverlay" bundle:nil]; 

    [self.view addSubview:splash.view]; 
} 

// do this code to get rid of the view 
- (void) doneWithSplashScreen { 
    [splash.view removeFromSuperview]; 
    [splash release]; 
    splash = nil; 
} 

보기는 아직 시작 화면 대기에서 수 있지만 당신이 준비가 될 때까지 아무도 그것과 상호 작용할 수 있습니다.

관련 문제