views:

59

answers:

1

Hi all, I'm using the old way to do animations for a simple animation, see below the code:

- (IBAction)footerButtonTapped:(id)sender {
if (footerActivated) {
    // Collapse the footer and resize the map.
    [UIView beginAnimations:@"collapseFooter" context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    CGRect footerFrame = [footerView frame];
    footerFrame.origin.y += 158;
    [footerView setFrame:footerFrame];

    CGRect mapFrame = [mapView frame];
    mapFrame.size.height += 158;
    [mapView setFrame:mapFrame];

    footerTitleLabel.alpha = 0.0;

    [UIView commitAnimations];

    // Disable the footer.
    footerActivated = NO;

    // Change the button.
    CGRect buttonFrame = [collapseExpandButton frame];
    buttonFrame.origin.x -= 27;
    buttonFrame.size.width += 54;
    UIImage *backgroundImage = [UIImage imageNamed:@"bottom-bar-expand-button.png"];
    [collapseExpandButton setFrame:buttonFrame];
    [collapseExpandButton setImage:backgroundImage forState:UIControlStateNormal];

    // TODO: Reload the map layers.

} else {
    // Collapse the footer and resize the map.
    [UIView beginAnimations:@"expandFooter" context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    CGRect footerFrame = [footerView frame];
    footerFrame.origin.y -= 158;
    [footerView setFrame:footerFrame];

    CGRect mapFrame = [mapView frame];
    mapFrame.size.height -= 158;
    [mapView setFrame:mapFrame];

    footerTitleLabel.alpha = 1.0;

    [UIView commitAnimations];

    // Enable the footer.
    footerActivated = YES;

    // Change the button.
    CGRect buttonFrame = [collapseExpandButton frame];
    buttonFrame.origin.x += 27;
    buttonFrame.size.width -= 54;
    UIImage *backgroundImage = [UIImage imageNamed:@"bottom-bar-collapse-button.png"];
    [collapseExpandButton setFrame:buttonFrame];
    [collapseExpandButton setImage:backgroundImage forState:UIControlStateNormal];

    // TODO: Reload the map layers.

}

}

My problem is for the mapView during the animation when expanding my footer. My footer is coming back to his original Y and so I am resizing the map. During the animation, there is no animation for the resizing of the map, so My footer is coming back up to its original coordinates, and while it is animating I can see the background (white) on top and at the bottom of my map... It is very annoying!

I know that people are using nowadays the CAAnimation from the QuartzCore framework, I tried it fast and the animation would just apply but coming to its original state later. I couldn't figure out out to manage everything with the delegate etc. (I didn't spend much time either on it yet).

Please help me finding out how I can resize my MKMapView object with animation! And no more white background... Thanks!

A: 

Still nobody for this interesting question?? Please help!

Dachmt