Skip to content

Instantly share code, notes, and snippets.

@markrickert
Created September 14, 2011 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save markrickert/1216751 to your computer and use it in GitHub Desktop.
Save markrickert/1216751 to your computer and use it in GitHub Desktop.
iOS Peel-Away Example
- (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