diff options
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs index 825a20bd..dce86b98 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs @@ -1,13 +1,7 @@ using Foundation; -#if __MOBILE__ using UIKit; -namespace Xamarin.Forms.Platform.iOS -#else -using AppKit; -using UIColor = AppKit.NSColor; -namespace Xamarin.Forms.Platform.MacOS -#endif +namespace Xamarin.Forms.Platform.iOS { public static class FormattedStringExtensions { @@ -25,16 +19,10 @@ namespace Xamarin.Forms.Platform.MacOS if (fgcolor.IsDefault) fgcolor = Color.Black; // as defined by apple docs -#if __MOBILE__ return new NSAttributedString(span.Text, font == Font.Default ? null : font.ToUIFont(), fgcolor.ToUIColor(), span.BackgroundColor.ToUIColor()); -#else - return new NSAttributedString(span.Text, font == Font.Default ? null : font.ToNSFont(), fgcolor.ToNSColor(), - span.BackgroundColor.ToNSColor()); -#endif } - public static NSAttributedString ToAttributed(this FormattedString formattedString, Font defaultFont, - Color defaultForegroundColor) + public static NSAttributedString ToAttributed(this FormattedString formattedString, Font defaultFont, Color defaultForegroundColor) { if (formattedString == null) return null; @@ -55,7 +43,6 @@ namespace Xamarin.Forms.Platform.MacOS if (span == null) return null; -#if __MOBILE__ UIFont targetFont; if (span.IsDefault()) targetFont = ((IFontElement)owner).ToUIFont(); @@ -69,25 +56,9 @@ namespace Xamarin.Forms.Platform.MacOS fgcolor = Color.Black; // as defined by apple docs return new NSAttributedString(span.Text, targetFont, fgcolor.ToUIColor(), span.BackgroundColor.ToUIColor()); -#else - NSFont targetFont; - if (span.IsDefault()) - targetFont = ((IFontElement)owner).ToNSFont(); - else - targetFont = span.ToNSFont(); - - var fgcolor = span.ForegroundColor; - if (fgcolor.IsDefault) - fgcolor = defaultForegroundColor; - if (fgcolor.IsDefault) - fgcolor = Color.Black; // as defined by apple docs - - return new NSAttributedString(span.Text, targetFont, fgcolor.ToNSColor(), span.BackgroundColor.ToNSColor()); -#endif } - internal static NSAttributedString ToAttributed(this FormattedString formattedString, Element owner, - Color defaultForegroundColor) + internal static NSAttributedString ToAttributed(this FormattedString formattedString, Element owner, Color defaultForegroundColor) { if (formattedString == null) return null; |