+

Search Tips   |   Advanced Search

Animating the transition from an Objective-C page to a web view

To implement a transition animation when switching the display from the native page to the web view, follow these instructions.

Within the animation code, call the [NativePage showWebView] method.

-(IBAction)returnClicked:(id)sender{
NSString *phone = [phoneNumber text];
NSDictionary *returnedData = [NSDictionary dictionaryWithObject:phone forKey:@"phoneNumber"];
// Animate transition with a flip effect
CDVAppDelegate *cordovaAppDelegate = (CDVAppDelegate *)[[UIApplication sharedApplication] delegate];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:[cordovaAppDelegate window] cache:YES];
[UIView commitAnimations];
// Return to WebView 
 [NativePage showWebView:returnedData]; 
}


Parent topic: Web and native code in iPhone, iPad, and Android