Posted By

jonathanbp on 06/19/08


Tagged

graphics flip views iphone


Versions (?)

Who likes this?

11 people have marked this snippet as a favorite

Leech
windmarble
arpit
cgrainger
mattnews
umang_nine
davidsi
stationstops
avanadra
epaga
cnathan


flipping a view on the iphone sdk


 / Published in: Objective C
 

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

  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  

You need to login to post a comment.