From 1976c28dc16b4d9ce023d6cf4c3ac58cf417cb15 Mon Sep 17 00:00:00 2001 From: Nedyalko Nikolov Date: Mon, 20 Jul 2015 15:20:53 +0300 Subject: [PATCH] Fixed span for ios. Fixes issue #452. --- text/formatted-string.ios.ts | 2 +- text/span.ios.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/text/formatted-string.ios.ts b/text/formatted-string.ios.ts index a66117402..61101ea10 100644 --- a/text/formatted-string.ios.ts +++ b/text/formatted-string.ios.ts @@ -21,7 +21,7 @@ export class FormattedString extends formattedStringCommon.FormattedString { for (p = 0; p < span.spanModifiers.length; p++) { attrDict.setObjectForKey(span.spanModifiers[p].value, span.spanModifiers[p].key); } - var nsAttributedString = NSMutableAttributedString.alloc().initWithStringAttributes(spanText, attrDict); + var nsAttributedString = NSMutableAttributedString.alloc().initWithStringAttributes(String(spanText), attrDict); mas.insertAttributedStringAtIndex(nsAttributedString, spanStart); spanStart += spanLength; } diff --git a/text/span.ios.ts b/text/span.ios.ts index 49b87e084..4cd725203 100644 --- a/text/span.ios.ts +++ b/text/span.ios.ts @@ -22,7 +22,8 @@ export class Span extends spanCommon.Span { if (realFontFamily) { font = UIFont.fontWithNameSize(realFontFamily, realFontSize); } - else { + + if (!font) { var fontDescriptor = UIFontDescriptor.new(); var symbolicTraits; if (realFontAttributes & enums.FontAttributes.Bold) { @@ -33,12 +34,11 @@ export class Span extends spanCommon.Span { } font = UIFont.fontWithDescriptorSize(fontDescriptor.fontDescriptorWithSymbolicTraits(symbolicTraits), realFontSize); } - if (font) { - this.spanModifiers.push({ - key: NSFontAttributeName, - value: font - }); - } + + this.spanModifiers.push({ + key: NSFontAttributeName, + value: font + }); } var realForegroundColor = this.foregroundColor ||