+

Search Tips   |   Advanced Search

Returning control to the web view from an Objective-C page

To switch back to the web view, follow these instructions.

The native page must be implemented as an Objective-C class that inherits from UIViewController. This UIViewController class must be able to initialize through the init method alone. The initWithNibName:bundle: method is never called on this class instance.

In the native page, call the [NativePage showWebView:] method and pass it an NSDictionary object (the object can be empty). This NSDictionary can be structured with any hierarchy. The MobileFirst runtime framework encodes it in JSON format, and then sends it as the first argument to the JavaScript callback function.

// The NSDictionary object will be sent as a JSON object to the JavaScript layer in the webview 
[NativePage showWebView:[NSDictionary dictionaryWithObject:@"value" forKey:@"key"]]


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

Related information:

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#/apple_ref/occ/cl/UIViewController