-
-
Save tibo/2480153 to your computer and use it in GitHub Desktop.
iOS Peel-Away Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction) pressedPeelIt:(UIButton *)sender | |
{ | |
//Disable the button so they can't press it | |
self.peelIt.enabled = NO; | |
[self.textHere resignFirstResponder]; | |
//Create a new UIView and set the background color to be a UIColor with pattern image of a screen capture | |
UIView *imgView = [[UIView alloc] init]; | |
[self.view addSubview:imgView]; | |
//This is where you would do everything to clear your interface | |
self.textHere.text = @""; //Set the text field to blank | |
[UIView transitionWithView:self.view | |
duration:1 | |
options:UIViewAnimationOptionTransitionCurlUp | |
animations:^{ | |
//Nothing here | |
} | |
completion:^(BOOL finished){ | |
[self.textHere becomeFirstResponder]; | |
[imgView removeFromSuperview]; | |
[imgView release]; | |
//Don't forget to re-enable the button at the completion block handler | |
self.peelIt.enabled = YES; | |
} | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment