新的使用NSDictionary,但需要一些指针,我做错了什么。转换NSDictionary initWithObjectAndKeys
我有一个NSDictionary,存储浮点值坐标:
页眉:
@class DetailViewController;
@interface MasterViewController : UITableViewController
@property (strong, nonatomic) DetailViewController *detailViewController;
@property (strong, nonatomic) NSArray *DestinationData;
@property (strong, nonatomic) NSArray *DestinationSections;
- (void)createDestinations;
主营:
@implementation MasterViewController
@synthesize detailViewController = _detailViewController;
@synthesize DestinationData;
@synthesize DestinationSections;
NSMutableArray *museumArray;
self.DestinationSections=[[NSArray alloc]initWithObjects:
...
...
(@"Museums"), nil];
[museumsArray addObject:[[NSDictionary alloc]
initWithObjectsAndKeys:@"Museum",@"Name",
@"51.5189100",@"Dest Lat",
@"-0.1263840",@"Dest Long",
nil]];
self.DestinationData=[[NSArray alloc] initWithObjects:
museumsArray, nil];
我希望能够从字典返回值并使用它与CLLocationCoordinate2D:
在DetailViewController中。 m:
CLLocationCoordinate2D destinationLocation;
如何设置该值,假设它应该是双倍的?
destinationLocation.latitude = [[self.detailItem objectForKey:@"Dest Lat"] doubleValue];
destinationLocation.longitude = [[self.detailItem objectForKey:@"Dest Long"] doubleValue];
MapViewAnnotation *destAnnotation = [[MapViewAnnotation alloc] initWithTitle:@"British Museum" andCoordinate:destinationLocation];
[self.detailGoogleMap addAnnotation:destAnnotation];
您收到了什么错误? – 2012-03-26 12:33:48
咦?你有什么问题?? – yuji 2012-03-26 12:34:38
当我通过我的坐标来绘制地图注记时,它不会将注记绘制在正确的位置。 – Jeremy 2012-03-26 12:48:02