mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fixed span for ios. Fixes issue #452.
This commit is contained in:
@ -21,7 +21,7 @@ export class FormattedString extends formattedStringCommon.FormattedString {
|
|||||||
for (p = 0; p < span.spanModifiers.length; p++) {
|
for (p = 0; p < span.spanModifiers.length; p++) {
|
||||||
attrDict.setObjectForKey(span.spanModifiers[p].value, span.spanModifiers[p].key);
|
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);
|
mas.insertAttributedStringAtIndex(nsAttributedString, spanStart);
|
||||||
spanStart += spanLength;
|
spanStart += spanLength;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ export class Span extends spanCommon.Span {
|
|||||||
if (realFontFamily) {
|
if (realFontFamily) {
|
||||||
font = UIFont.fontWithNameSize(realFontFamily, realFontSize);
|
font = UIFont.fontWithNameSize(realFontFamily, realFontSize);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (!font) {
|
||||||
var fontDescriptor = UIFontDescriptor.new();
|
var fontDescriptor = UIFontDescriptor.new();
|
||||||
var symbolicTraits;
|
var symbolicTraits;
|
||||||
if (realFontAttributes & enums.FontAttributes.Bold) {
|
if (realFontAttributes & enums.FontAttributes.Bold) {
|
||||||
@ -33,12 +34,11 @@ export class Span extends spanCommon.Span {
|
|||||||
}
|
}
|
||||||
font = UIFont.fontWithDescriptorSize(fontDescriptor.fontDescriptorWithSymbolicTraits(symbolicTraits), realFontSize);
|
font = UIFont.fontWithDescriptorSize(fontDescriptor.fontDescriptorWithSymbolicTraits(symbolicTraits), realFontSize);
|
||||||
}
|
}
|
||||||
if (font) {
|
|
||||||
this.spanModifiers.push({
|
this.spanModifiers.push({
|
||||||
key: NSFontAttributeName,
|
key: NSFontAttributeName,
|
||||||
value: font
|
value: font
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var realForegroundColor = this.foregroundColor ||
|
var realForegroundColor = this.foregroundColor ||
|
||||||
|
Reference in New Issue
Block a user