Developer

MAFUILabel

MAFUILabel uses the MAFStyling protocol to extend the native UILabel class with MAF styling capability.

To create and present a default SAP-style-based instance of MAFUILabel, use:
MAFUILabel* label = [[MAFUILabel alloc] initWithFrame:CGRectMake(60, 30, 200, 40)];
[label setText:@"Standard label"];
[self.view addSubview:label];
[label release];

Skinned MAFUILabel Instance

Figure 3: Skinned MAFUILabel Instance
The default skin is based on the Label TargetType defined in Styles.xml (available from the MAFUIComponents.bundle). To apply SAP style, set the custom style in the XML file for background, font family, font size, content alignment, and text color:
<Style TargetType="Label" platform="ios">
        <VisualStates>
            <VisualState Name="Highlighted">
                <Setter Property="Shadow" Value="#FFFFFF"/>
            </VisualState>
        </VisualStates>
        <Setter Property="FontFamily" Value="Helvetica-Bold"/>
        <Setter Property="FontSize" Value="17"/>
        <Setter Property="Foreground" Value="#555555"/>
        <Setter Property="Background" Value="#00000000"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
</Style>
You can change these properties in the skinning XML:
Background Color of the UILabel's background; can be only a solid color, no freestyle gradient. Colors are defined as RGBA (red, green, blue, alpha).
TextColor The control's text color.
FontFamily The control's font family.
FontSize The control's font size.
HorizontalContentAlignment Horizontal alignment of the control's text.
VerticalContentAlignment Vertical alignment of the control's text.
Border The border attributes of the MAFUILabel include:
  • Borderbrush – defines the color.
  • BorderThickness – is the width of the border.
  • CornerRadius – is the angle of the edge.
Shadow The color of the control’s text shadow (shifted 2px*2px on x and y axis).