flipping a view on the iphone sdk


/ Published in: Objective C
Save to your folder(s)

the controllers view is setup s.t. it adds the mainView as a subview to its default view in the init method


Copy this code and paste it in your HTML
  1. - (void) flipView {
  2. [UIView beginAnimations:nil context:NULL];
  3. [UIView setAnimationDuration:kTransitionDuration];
  4.  
  5. [UIView setAnimationTransition:([mainView superview] ?
  6. UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
  7. forView:self.view cache:YES];
  8.  
  9. if ([flipView superview])
  10. {
  11. [flipView removeFromSuperview];
  12. [self.view addSubview:mainView];
  13. }
  14. else
  15. {
  16. [mainView removeFromSuperview];
  17. [self.view addSubview:flipView];
  18. }
  19.  
  20. [UIView commitAnimations];
  21. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.