views:

22

answers:

0

Hallo!

That's really strange.. i'm changing the frame between two states. In case one, it's animated correctly, in case two (back to original size) only x/y is animated, but width/height instantly changes. Any Idea?

Greetz

// strange behavior
 [UIView beginAnimations: @"photobtn" context: nil];
 [UIView setAnimationDuration: 0.15];

 if (CGRectGetWidth(mPhotoButton.frame) == CGRectGetWidth(mOriginalPhotoFrame)) {

  int margin = 10;

  CGRect frame = mMapView.frame;
  frame.size.width -= margin*2;
  frame.size.height -= margin*2;
  frame.origin.x += margin;
  frame.origin.y += margin;

  mPhotoButton.frame = frame;
 } else {

  mPhotoButton.frame = mOriginalPhotoFrame;
 }

 [UIView commitAnimations];