Developer

MAFUIImageView

MAFUIImageView extends the native UIImageView class with MAF styling capability using the MAFStyling protocol.This control can present images that are encoded in the XML style description, and images that are available from a remote location or as a file from a resource bundle.

To create and present the MAFUIImageView, use:
//add image from base 64 encoded
MAFUIImageView* imageBase64 = [[[MAFUIImageView alloc] init] autorelease];
[imageBase64 setFrame:CGRectMake(20, 44, 70, 70)];
imageBase64.mafStyleName = @"sapimage_base64encoded";
[self.view addSubview:imageBase64];
//add image from url
MAFUIImageView* imageURL = [[[MAFUIImageView alloc] init] autorelease];
[imageURL setFrame:CGRectMake(100, 44, 70, 70)];
imageURL.mafStyleName=@"sapimage";
[self.view addSubview:imageURL];
//add image from bundle
MAFUIImageView* imageBundle = [[[MAFUIImageView alloc] init] autorelease];
[imageBundle setFrame:CGRectMake(180, 44, 90, 70)];
imageBundle.mafStyleName = @"bundleimage";
[self.view addSubview:imageBundle];
To change the appearance or content presented in the MAFUIImageView, define a custom XML style class. This example loads the image source from a remote location via a URL:
<Style basedOn="Image" Key="sapimage">
	<ImageBrush Height="33"
		ImageSource="http://www.sap.com/global/ui/images/global/sap-logo.png" Width="66"/>
</Style>
You can use the same tag to load images from a Base64-coded string or from a file located in the project.
You can change these properties in the skinning XML:
Background Color of the MAFUIImageView's background; cannot be a freestyle gradient. This is the color of the area that the image does not cover, or where the image is transparent. Colors are defined as RGBA (red, green, blue, alpha).
BackgroundImage The background image for the control.
Border The border attributes of the MAFUIImageView include:
  • Borderbrush – defines the color.
  • BorderThickness – is the width of the border.
  • CornerRadius – is the angle of the edge.