MKMapView won't scale or animate on iPad REAL DEVICE with iOS6

I have a UITableView with coordinates (stored in arrays) displayed on each row, and I want to center (scale and animate) my MKMapView at those coordinates when I use the table rows. This is a simple classic didSelectRowAtIndexPath method

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    latitude = [dataSourceLatitude objectAtIndex:indexPath.row];
    longitude = [dataSourceLongitude objectAtIndex:indexPath.row];

    MKCoordinateRegion region;
    region.center.latitude = latitudine.floatValue;
    region.center.longitude = longitude.floatValue;
    region.span.latitudeDelta = 0.20;
    region.span.longitudeDelta = 0.20;
    [map setRegion:region animated:TRUE];

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

      

Well, it works with every simulator and device, but not on the iPad REAL DEVICE with iOS6: here I can see the map scale and center by coordinates ONLY AT THE FIRST moment I click a table row; with the following taps on a different line, I can see the map centered directly on the coordinates, no scaling or animation. So here's the thing:

iPhone 5.1 simulator = it works!
iPad 5.1 simulator = it works
iPhone 5.1 REAL DEVICE = it works!

iPhone 6 simulator = it works!
iPad 6 simulator = it works
iPad 6 REAL DEVICE = it DOESN'T WORK!

      

EDIT: I am also having problems with pinView animatesDrop: on a REAL DEVICE iPad with iOS6. I don't see the drop animation, but the contacts are attached directly to the card. I used this elegant code from @Anna Karenina and it doesn't work ONLY on iOS6:

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)annotationViews
{
    NSTimeInterval delayInterval = 0;       
    for (MKAnnotationView *annView in annotationViews)
    {
        CGRect endFrame = annView.frame;           
        annView.frame = CGRectOffset(endFrame, 0, -500);            
        [UIView animateWithDuration:1.500
                              delay:delayInterval
                            options:UIViewAnimationOptionAllowUserInteraction
                         animations:^{ annView.frame = endFrame; }
                         completion:NULL];         
        delayInterval += 0.1500;
    }
}

      

Is this a well known issue? Can I work it out? Thank!

+3


source to share


1 answer


In all these cases, are you using exactly the same coordinates? The animation is skipped if your current view is too far from the target view. For example: All Europe → Italy = gradual increase. 1st Street, Nobodyville, OH → Le First Street, PetiteVille, France = instant snap.



0


source







All Articles