Working with Web Page View

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example describes some methods of working with web page view. After starting the example the following operations are executed:

Source Code

Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Dashboard section):

// Get dashboard controller
MADashboardReportViewController *dashboard = (MADashboardReportViewController *)m_controller;
// Get dashboard
APKap *kap = [dashboard report];
// Create a controller for displaying web page
MAWebDataViewController *webCtrl = [dashboard createWebDataViewController];
// Specify web page URL
[webCtrl setUrl:@"http://www.example.com/sites/default/image/image.png"];
// Set
[webCtrl setText:@"Prognoz"];
// Get last composite block
APCompositeBlock *block = [[[kap compositeBlocks] allValues]
                           objectAtIndex: ([[kap compositeBlocks] count] - 1)];
// Link obtained block to web page view
[webCtrl setContr:block];
// Load web page
[webCtrl loadView];
// Display text that is set for web page view
[[webCtrl navigationItem] setTitle:[webCtrl text]];
// Display composite block title
NSString *blockTitle = [kap titleForCompositeBlock:[[webCtrl contr] key]];
[[webCtrl navigationItem] setPrompt: blockTitle];
// Display web page view
[self showViewControllerInNavigationController: webCtrl];

After executing the example the web page with image, the text and name of the related composite block are displayed:

See also:

Example of Component Use