Search code examples
objective-cipaduiviewcore-animationtransition

Is it possible to do a pre-4.0 equivalent of UIView transitionWithView using Core Animation?


I have an iPad 3.2 project where if you swipe left or right, it goes to a duplicate view with all the elements updated with the new data. However, in iOS 4.0 you can use transitionWithView:duration:options:animations:completion: on a single view to do the same thing.

So my question is, using Core Animation, can I do the same thing in iOS 3.2? I'm badly running out of RAM because having a duplicate view (a very complicated view) is using up a lot of memory and I'm running into memory warnings.

Thanks!

:-Joe


Solution

  • [self.view addSubview:myNewView];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:duration];
    [UIView setAnimationTransition:transition forView:view cache:YES];
    // do view modifications that you did in the animations block
    CGRect frame = myOldView.frame;
    myNewView.frame = frame;
    frame.origin.x = 320;
    [myOldView setFrame:frame];
    [UIView commitAnimations];