我试图将注释点加载到mapview
其中我有单独的纬度数组和单独的经度数组这是我的代码
- (void)viewDidLoad
{
[super viewDidLoad];
delegate=[[UIApplication sharedApplication]delegate];
delegate.arrForLat=[[NSMutablearray alloc]initwithobjects:@"33.930216",@"33.939788",@"33.9272",@"33.902237"];
delegate.arrForLon=[[NSMutablearray alloc]initwithobjects:@"-118.050392",@"-118.076549",@"-118.065817",@"-118.081733"];
for (int i=0 ; i< delegate.arrForLat.count;i++)
{
annotationCoord.latitude = [[delegate.arrForLat objectAtIndex:i] doubleValue];
annotationCoord.longitude = [[delegate.arrForLng objectAtIndex:i] doubleValue];
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = annotationCoord;
[MapView addAnnotation:annotationPoint];
}
}
现在我只得到 1 个注释点,mapview
但我有 4 个坐标。我不知道我犯了什么错误。