0

注釈の配列を表示するマップがあります。これらの注釈はすべて plist から呼び出され、それぞれが発生した日付を持っています。これらの注釈が発生した日付にのみ表示されるようにしたいのですが、これにアプローチする方法がわかりません。どんな助けでも大歓迎です。

for (NSString *dateString in contentArray) {
    [[NSUserDefaults standardUserDefaults] stringForKey:@"Date"];
}

これは私が書いた小さなコードですが、何も解決しません。

編集:これは、一般的に注釈を呼び出すコードです。

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
    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];
    [self zoomToUserLocation:mapViewuno.userLocation];
}
- (void)zoomToUserLocation:(MKUserLocation *)userLocation
{
    if (!userLocation)
        return;

    MKCoordinateRegion region;
    region.center = userLocation.location.coordinate;
    region.span = MKCoordinateSpanMake(.5, .5);
    region = [mapViewuno regionThatFits:region];
    [mapViewuno setRegion:region animated:YES];
    counter = 0;

    [mapViewuno removeAnnotations:mapViewuno.annotations];

    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;
            [mapViewuno addAnnotation:obj];
        }
        if ([mapViewuno.annotations count] == 0) return;

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

    }
}
4

0 に答える 0