我有这个功能抢lat和长在我的应用程序委托,和它的正常工作:发送纬度和经度坐标的didFinishLaunchingWithOptions在应用程序委托
- (void)newPhysicalLocation:(CLLocation *)location {
// Store for later use
self.lastKnownLocation = location;
// Remove spinner from view
for (UIView *v in [self.viewController.view subviews])
{
if ([v class] == [UIActivityIndicatorView class])
{
[v removeFromSuperview];
break;
}
}
// Alert user
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Found" message:[NSString stringWithFormat:@"Found physical location. %f %f", self.lastKnownLocation.coordinate.latitude, self.lastKnownLocation.coordinate.longitude] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
currentLatitude = (self.lastKnownLocation.coordinate.latitude);
NSLog(@"current latitude: %f",self.lastKnownLocation.coordinate.latitude);
currentLongitude = (self.lastKnownLocation.coordinate.longitude);
NSLog(@"current longitude: %f",currentLongitude);
}
不过,我想将currentLatitude和currentLongitude值发送到didFinishLaunchingWithOptions部分中的应用程序委托的顶部。我试图做到这一点,所以我可以将值传递到另一个的viewController中,我已经设置了:
MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
我可以发送currentLatitude和currentLongitude值的didFinishLaunchingWithOptions部分?
感谢,我也类似于此的实施,并得到它的工作 – Aaron 2011-03-09 13:34:45
请接受和/或投票,如果答案是有帮助您。其他人可能会找到与他们的问题相关的答案。谢谢,不客气。 – Angelo 2011-03-10 03:00:20