Exemplo n.º 1
0
 public NSAttributedString(string str, UIStringAttributes attributes)
     : this(str, attributes != null ? attributes.Dictionary : null)
 {
 }
Exemplo n.º 2
0
 internal static NSDictionary ToDictionary(
     UIFont font,
     UIColor foregroundColor,
     UIColor backgroundColor,
     UIColor strokeColor,
     NSParagraphStyle paragraphStyle,
     NSLigatureType ligature,
     float kerning,
     NSUnderlineStyle underlineStyle,
     NSShadow shadow,
     float strokeWidth,
     NSUnderlineStyle strikethroughStyle)
 {
     var attr = new UIStringAttributes ();
     if (font != null){
         attr.Font = font;
     }
     if (foregroundColor != null){
         attr.ForegroundColor = foregroundColor;
     }
     if (backgroundColor != null){
         attr.BackgroundColor = backgroundColor;
     }
     if (strokeColor != null){
         attr.StrokeColor = strokeColor;
     }
     if (paragraphStyle != null){
         attr.ParagraphStyle = paragraphStyle;
     }
     if (ligature != NSLigatureType.Default){
         attr.Ligature = ligature;
     }
     if (kerning != 0){
         attr.KerningAdjustment = kerning;
     }
     if (underlineStyle != NSUnderlineStyle.None){
         attr.UnderlineStyle = underlineStyle;
     }
     if (shadow != null){
         attr.Shadow = shadow;
     }
     if (strokeWidth != 0){
         attr.StrokeWidth = strokeWidth;
     }
     if (strikethroughStyle != NSUnderlineStyle.None){
         attr.StrikethroughStyle = strikethroughStyle;
     }
     var dict = attr.Dictionary;
     return dict.Count == 0 ? null : dict;
 }
Exemplo n.º 3
0
 public void AddAttributes(UIStringAttributes attrs, NSRange range)
 {
     AddAttributes (attrs == null ? null : attrs.Dictionary, range);
 }