2012-12-12 6 views

답변

1

이 경고는 CLLocationManager

-(void)getLocation 
{ 
    locationManager = [[CLLocationManager alloc] init]; 
    locationManager.delegate = self; 
    locationManager.distanceFilter = kCLLocationAccuracyHundredMeters; 
    locationManager.desiredAccuracy = kCLLocationAccuracyBest; 

    NSLog(@"eee%f",locationManager.location.coordinate.latitude); 
    // Start updating location changes. 
    [locationManager startUpdatingLocation]; 
} 


- (void)startUpdatingCurrentLocation 
{ 
    //NSLog(@"STARTUPDATELOCATION"); 
    // if location services are restricted do nothing 
    if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied || 
     [CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted) 
    { 
     return; 
    } 

    // if locationManager does not currently exist, create it 
    if (!locationManager) 
    { 
     locationManager = [[CLLocationManager alloc] init]; 
     [locationManager setDelegate:self]; 
     locationManager.distanceFilter = 10.0f; // we don't need to be any more accurate than 10m 


    } 

    [locationManager startUpdatingLocation]; 

    // [self showCurrentLocationSpinner:YES]; 
} 

그냥 더 많은 정보

에 대한 CLLocationManager Class Reference을 읽을 사용하여 사용자의 현재 위치를 액세스 할 때 때 액세스 사용자의 현재 위치를이 자동으로 물어볼 것입니다
0

좋아, 그 빌어 먹을 간단. 그 전화는 UIAlertView이며 알림을 제공하는 데 매우 일반적입니다. 사용자에게 뭔가를 알리고 상호 작용을 위해 너무 많이 사용하지 말아야합니다. 다른 버튼 타이틀을 원하는 경우

[alert show]; 

, 당신은 selfdelegate을 설정하고 준수해야합니다

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert Body" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil]; 

이 경고를 표시하려면 : 현명한 코딩

, 여기에 몇 가지 기본 설정 텍스트입니다 당신 .h 파일에서 UIAlertViewDelegate. Here Is The Reference To The Delegate이고 기본적으로 clickedButtonAtIndex: 메서드를 구현하고 인덱스로 작업하여 사용자가 누른 단추를 찾고 작업을 수행하려고합니다.

Do not misuse alert views.

관련 문제