从URL而不是plist下载Map注释列表

时间:2013-11-09 03:20:29

标签: ios annotations mapkit parse-platform

有谁知道我如何操作下面的代码,以便内容不是从plist中提取而是从parse.com中提取?

indexValue = 0;
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"mapAddress" ofType:@"plist"];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
NSString *strID = [NSString stringWithFormat:@"%d",intID];
NSLog(@"array : %@",[dict objectForKey:strID]);
[contentArray removeAllObjects];
[contentArray addObjectsFromArray:[dict objectForKey:strID]];
[contentArray retain];

}

if([contentArray count] != 0)
{
    for(indexValue = 0; indexValue<[contentArray count];indexValue++)
    {
        FirstAnnotation *obj=[[FirstAnnotation alloc]init];

        obj.latitude = [[[contentArray objectAtIndex:indexValue] objectForKey:@"lattitude"] floatValue];
        obj.longitude = [[[contentArray objectAtIndex:indexValue] objectForKey:@"Longitude"] floatValue];

        obj.titleName=[[contentArray objectAtIndex:indexValue] objectForKey:@"Title"];

        obj.Address = [[contentArray objectAtIndex:indexValue] objectForKey:@"Address"];

        obj.Phone = [[contentArray objectAtIndex:indexValue] objectForKey:@"Phone"];

        obj.intTag = indexValue;
        [mapViewextra addAnnotation:obj];
    }
    if ([mapViewextra.annotations count] == 0) return;

    //        [self.mapView setRegion:newRegion animated:YES];
}

}

1 个答案:

答案 0 :(得分:0)

此链接对您有用 - &gt; https://parse.com/docs/ios_guide#objects/iOS

它将有助于检索对象并将其存储在字典**