2013-03-28 4 views
1
RootViewController *objYourViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 
CATransition* transition = [CATransition animation]; 
transition.duration = 1.0; 
transition.type = kCATransitionPush; 
transition.subtype = kCATransitionPush; 
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; 
[self.navigationController pushViewController:objYourViewController animated:YES]; 

Это используется, чтобы указывать текущее местоположение. Теперь я хочу получить текущую информацию о местоположении в текстовом поле или в таблице, поэтому, пожалуйста, помогите мне, если кто-нибудь узнает.в MKMapkit как получить текущую информацию о местоположении в текстовом поле или табличном виде

ответ

1

я был использовать сильфон код ..

First Добавить MKReverseGeocoderDelegate в .h файл ..

после создания объекта MKReverseGeocoder в .h файл как belolow ..

MKReverseGeocoder *mkReverseGeocoder; 

, а затем использовать его наподобие сильфона на вашем UIButton Мероприятие

-(IBAction)btnFindMe_Clicked:(id)sender{ 
    if(mkReverseGeocoder) 
    { 
     [mkReverseGeocoder autorelease]; 
    } 

    mkReverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:[currLocation coordinate]]; 

    [mkReverseGeocoder setDelegate:self]; 
    [mkReverseGeocoder start]; 
} 

и это гофрированные методы являются методами делегата MKReverseGeocoder

//mkreversegeocoder protocol methods 

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error 
{ 

    [appDelegate hideLoadingView]; 
    UIAlertView *alt=[[UIAlertView alloc]initWithTitle:@"Error" message:@"Try Again After Sometime" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; 
    [alt show]; 
    [alt release]; 
// NSLog(@"\n\n Error is %@",[error description]); 
} 

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark 
{ 

    [appDelegate hideLoadingView]; 
    NSLog(@"\n\n Address Dict : %@",[[placemark addressDictionary] description]); 
    txtCity.text=[[placemark addressDictionary] objectForKey:@"City"]; 
    txtState.text=[[placemark addressDictionary] objectForKey:@"State"]; 
    txtAddress1.text=[[placemark addressDictionary] objectForKey:@"Street"]; 
    txtAddress2.text=[[placemark addressDictionary] objectForKey:@"SubLocality"]; 
    //[NSString stringWithFormat:@"%@", [[gpsTextView addressDictionary] description], ]; 
} 

Также смотрите эту ссылку, например, но другой свой код .. выше мой пользовательский код ... how-to-get-current-latitude-and-longitude-in-iphone/

я надеюсь, что это полезно вы ..

+0

@vishnu см. эту ссылку также с учебником .. http://www.edumobile.org/iphone/miscellaneous/how-to-get-current-latitude-and-longitude-in-iphone/ :) –

+0

парами Джоши. can u pls help me.i не может найти текущее местоположение ... Мне нужно текущее местоположение как значение по умолчанию в tableview. – vishnu

+0

@vishnu вы хотите в текущее местоположение ??? –

Смежные вопросы