You are making things harder then they have to be. Check out the iphone 3.0SDK's Utility project's code. Also, the video above illustrates the easier way to do it. I will have the project's code available online soon. The narrative, though, is part of my upcoming book. Again, the technique my original video shows, and your tutorial shows, works, but isn't required
James A. Brannan
Quote:
Originally Posted by chaseacton
Here's my version of the utility app tutorial complete with sound, code, and the xcode project!
Here is the video:
Flip View Tutorial on Vimeo
Here is the code in case it was too hard to read in the video:
.h file:
Code:
@interface MainViewController : UIViewController {
IBOutlet UIView *secondaryView;
}
- (IBAction)toggleView:(id)sender; //Action for toggle view
- (IBAction)returnView:(id)sender;
@end
.m file:
Code:
//Flips to back when toggle button is pressed
- (IBAction)toggleView:(id)sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:[self view]
cache:YES];
[[self view] addSubview:secondaryView];
[UIView commitAnimations];
}
//Flips to front when "Done" is pressed
- (IBAction)returnView:(id)sender {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:[self view]
cache:YES];
[secondaryView removeFromSuperview];
[UIView commitAnimations];
}
Here is the finished project:
TutFlip.zip
|