Skip to content

Commit 0e3674d

Browse files
committed
fix(ios): more fixes
1 parent 9b60561 commit 0e3674d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/canvas.ios.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ export class Paint implements IPaint {
10811081
return this.font.getUIFont(UIFont.systemFontOfSize(UIFont.labelFontSize));
10821082
}
10831083
getUIColor() {
1084-
return this._color.ios as UIColor;
1084+
return this._color && this._color.ios as UIColor;
10851085
}
10861086

10871087
public getTextSize(): number {
@@ -1192,7 +1192,12 @@ export class Paint implements IPaint {
11921192
_textAttribs: NSMutableDictionary<any, any>;
11931193
getDrawTextAttribs() {
11941194
if (!this._textAttribs) {
1195-
this._textAttribs = NSMutableDictionary.dictionaryWithObjectsForKeys([this.getUIFont(), this.getUIColor()], [NSFontAttributeName, NSForegroundColorAttributeName]);
1195+
this._textAttribs = NSMutableDictionary.dictionaryWithObjectsForKeys([this.getUIFont()], [NSFontAttributeName]);
1196+
const color = this.getUIColor();
1197+
this._textAttribs = NSMutableDictionary.dictionaryWithObjectsForKeys([this.getUIFont()], [NSFontAttributeName]);
1198+
if (color) {
1199+
this._textAttribs.setObjectForKey(color, NSForegroundColorAttributeName);
1200+
}
11961201
if (this.align === Align.CENTER) {
11971202
const paragraphStyle = NSMutableParagraphStyle.new();
11981203
paragraphStyle.alignment = NSTextAlignment.Center;

0 commit comments

Comments
 (0)