0

I have a question regarding transitioning between uiviews. I have a view1 that transition to view2, but when i want to transition back it doesn't work.

Action called on first view to flip to the second view.

- (IBAction)flip:(id)sender {
    [UIView transitionFromView:view1 toView:view2 duration:1.0 options: UIViewAnimationOptionTransitionFlipFromLeft
                    completion: ^(BOOL inFinished) {
                    }];

}

Action called on second view:

- (IBAction)flipBack:(id)sender {
    [UIView transitionFromView:view2 toView:view1 duration:1.0 options: UIViewAnimationOptionTransitionFlipFromLeft
                    completion: ^(BOOL inFinished) {
                    }];
}

Thank you!

zevonja
  • 193
  • 1
  • 14
  • Is view1 still in memory? – Maarten May 14 '13 at 15:54
  • My first thought is that things are probably not wired up in IB. Is View2 within the xib and wired to the flipBack method? If it isn't in the xib, do you use addTarget:action:forControlEvents: to connect it with the action? – Sean Kladek May 14 '13 at 15:56

1 Answers1

0

You need to hold a strong reference to both views - when view1 is removed it will be deallocated unless you keep hold of a strong reference to it.

jhabbott
  • 18,461
  • 9
  • 58
  • 95