я был использовать сильфон код ..
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/
я надеюсь, что это полезно вы ..
@vishnu см. эту ссылку также с учебником .. http://www.edumobile.org/iphone/miscellaneous/how-to-get-current-latitude-and-longitude-in-iphone/ :) –
парами Джоши. can u pls help me.i не может найти текущее местоположение ... Мне нужно текущее местоположение как значение по умолчанию в tableview. – vishnu
@vishnu вы хотите в текущее местоположение ??? –