We Recommend

Programming in Objective-C Programming in Objective-C
Programming in Objective-C is a concise, carefully written tutorial on the basics of Objective-C and object-oriented programming. The book makes no assumption about prior experience with object-oriented programming languages or with the C language (upon which Objective-C is based). And because of this, both novice and experienced programmers alike can use this book to quickly and effectively learn the fundamentals of Objective-C.


Posted By

jonathanbp on 06/19/08


Tagged

graphics flip views iphone


Versions (?)


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.