问题描述
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];
这用于指向当前位置。现在我想在textfield或tableview中获取当前位置详细信息,所以如果有人知道的话,请帮助我。
This is used to point the current location. Now i want to get the current location detail in textfield or tableview so please help me if any one know.
推荐答案
我使用过下面的代码..
i had use bellow code..
首先在 .h
MKReverseGeocoderDelegate >文件..
First Add MKReverseGeocoderDelegate
in .h
file..
在 .h $ c中创建
MKReverseGeocoder
对象后$ c>像belolow这样的文件..
after create object of MKReverseGeocoder
in .h
file like belolow..
MKReverseGeocoder *mkReverseGeocoder;
然后在你的 UIButton
动作事件
-(IBAction)btnFindMe_Clicked:(id)sender{
if(mkReverseGeocoder)
{
[mkReverseGeocoder autorelease];
}
mkReverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:[currLocation coordinate]];
[mkReverseGeocoder setDelegate:self];
[mkReverseGeocoder start];
}
这个bellow方法是 MKReverseGeocoder
and this bellow methods are delegate methods of 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], ];
}
另请参阅此链接以示例,但其另一个代码..上面是我的自定义代码...
Also See this link with example but its another code.. above is my custom code... how-to-get-current-latitude-and-longitude-in-iphone/
我希望这对你有所帮助..
i hope this is helpful to you..
这篇关于在MKMapkit中如何获取textfield或tableview中的当前位置详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!