Working with Image View

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example describes the operations that enable the user to display specified image on the mobile device screen.

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;
// Create an image view controller
MAImageDataViewController *imageCtrl = [dashboard createImageDataViewController];
// Specify image URL
NSURL *imageURL = [NSURL URLWithString:@"http://www.example.com/sites/default/images/image.png"];
// Get image as a encoded string
NSString *imageBase64String = [[NSData dataWithContentsOfURL:imageURL] base64Encoding];
// Get image data from encoded string
NSData *imageData = [MAImageDataViewController base64DataFromString: imageBase64String];
[imageCtrl setImageData:imageData];
// Display image view
[self showViewControllerInFullScreen: imageCtrl];

After executing the example the mobile device screen displays the specified image:

See also:

Example of Component Use