Show TOC

MAFUIViewLocate this document in the navigation structure

MAFUIView uses the MAFStyling protocol to extend the native UIView class with MAF styling capability.You can use this wrapper object to style the border and background of any UIView subclass. To inherit basic MAF skinning capability, inherit your own control views from this class.

To create and present a default SAP-style-based instance of MAFUIView, use:
MAFUIView* mafUIView = [[MAFUIView alloc]init];
[mafUIView sizeToFit];
[self setView:mafUIView];
//release mafUIView instance if not ARC based project.
[mafUIView release];
This creates an empty UIView that has a solid background color and a border brush. To change the style of this MAFUIView instance, define a simple style:
<Style Key="mafUIViewSampleStyle" TargetType="Window" platform="ios">
        <Setter Property="Background" Value="#FFFFFF"/>
        <Border BorderBrush="#007AB6" BorderThickness="4"/>
This XML definition applies a white background color and a blue 4-point border around the frame of the UIView.
To apply this style to a UIView instance, set the mafUIViewSampleStyle style name as a value for the mafStyleName property of the MAFUIStyling protocol:
[mafUIView setMafStyleName:@"mafUIViewSampleStyle"];

Set mafUIViewSampleStyle as a style name to any MAFUIView subclass to set its border brush and background. The background property can also apply a freestyle gradient.

You can change thede properties in the skinning XML:
Background Color of the UIView's background; can also be a freestyle gradient. Colors are defined as RGBA (red, green, blue, alpha).  
Border The border attributes of the UIView include:
  • Borderbrush – defines the color.
  • BorderThickness – is the width of the border.
  • CornerRadius – is the angle of the edge.