mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
NSMutableArray changed to Array and NSMutableDictionary changed to Map
This commit is contained in:
@@ -68,36 +68,35 @@ export module ios {
|
|||||||
for (let i = 0; i < v.formattedText.spans.length; i++) {
|
for (let i = 0; i < v.formattedText.spans.length; i++) {
|
||||||
let span = v.formattedText.spans.getItem(i);
|
let span = v.formattedText.spans.getItem(i);
|
||||||
span.text = getTransformedText(v, span.text, transform);
|
span.text = getTransformedText(v, span.text, transform);
|
||||||
console.log("HERE: " + span.text);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let source = v.text;
|
let source = v.text;
|
||||||
let attributes = NSMutableArray.array();
|
let attributes = new Array();
|
||||||
let range = { location: 0, length: source.length };
|
let range = { location: 0, length: source.length };
|
||||||
|
|
||||||
var decorationValues = (decoration + "").split(" ");
|
var decorationValues = (decoration + "").split(" ");
|
||||||
|
|
||||||
if (decorationValues.indexOf(enums.TextDecoration.none) === -1) {
|
if (decorationValues.indexOf(enums.TextDecoration.none) === -1) {
|
||||||
let dict = NSMutableDictionary.new();
|
let dict = new Map<string, number>();
|
||||||
|
|
||||||
if (decorationValues.indexOf(enums.TextDecoration.underline) !== -1) {
|
if (decorationValues.indexOf(enums.TextDecoration.underline) !== -1) {
|
||||||
dict.setValueForKey(NSUnderlineStyle.NSUnderlineStyleSingle, NSUnderlineStyleAttributeName);
|
dict.set(NSUnderlineStyleAttributeName, NSUnderlineStyle.NSUnderlineStyleSingle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decorationValues.indexOf(enums.TextDecoration.lineThrough) !== -1) {
|
if (decorationValues.indexOf(enums.TextDecoration.lineThrough) !== -1) {
|
||||||
dict.setValueForKey(NSUnderlineStyle.NSUnderlineStyleSingle, NSStrikethroughStyleAttributeName);
|
dict.set(NSStrikethroughStyleAttributeName, NSUnderlineStyle.NSUnderlineStyleSingle);
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes.addObject({ attrs: dict, range: NSValue.valueWithRange(range) });
|
attributes.push({ attrs: dict, range: NSValue.valueWithRange(range) });
|
||||||
}
|
}
|
||||||
|
|
||||||
let view: dts.ios.TextUIView | UIButton = v._nativeView;
|
let view: dts.ios.TextUIView | UIButton = v._nativeView;
|
||||||
|
|
||||||
source = getTransformedText(v, source, transform);
|
source = getTransformedText(v, source, transform);
|
||||||
|
|
||||||
if (attributes.count > 0) {
|
if (attributes.length > 0) {
|
||||||
let result = NSMutableAttributedString.alloc().initWithString(<string>source);
|
let result = NSMutableAttributedString.alloc().initWithString(<string>source);
|
||||||
for (let i = 0; i < attributes.count; i++) {
|
for (let i = 0; i < attributes.length; i++) {
|
||||||
result.setAttributesRange(attributes[i]["attrs"], attributes[i]["range"].rangeValue);
|
result.setAttributesRange(attributes[i]["attrs"], attributes[i]["range"].rangeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user