我有這個功能搶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