mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(css): text-stroke support (#10399)
closes https://github.com/NativeScript/NativeScript/issues/3597 closes https://github.com/NativeScript/NativeScript/issues/3972
This commit is contained in:
@@ -10,4 +10,6 @@
|
||||
|
||||
-(void)nativeScriptSetFormattedTextDecorationAndTransform:(NSDictionary*)details letterSpacing:(CGFloat)letterSpacing lineHeight:(CGFloat)lineHeight;
|
||||
|
||||
-(void)nativeScriptSetFormattedTextStroke:(CGFloat)width color:(UIColor*)color;
|
||||
|
||||
@end
|
||||
|
||||
@@ -130,4 +130,19 @@
|
||||
((UILabel*)self).attributedText = attrText;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)nativeScriptSetFormattedTextStroke:(CGFloat)width color:(UIColor*)color {
|
||||
if (width > 0) {
|
||||
NSMutableAttributedString *attrText = [[NSMutableAttributedString alloc] initWithAttributedString:((UILabel*)self).attributedText];
|
||||
[attrText addAttribute:NSStrokeWidthAttributeName value:[NSNumber numberWithFloat:width] range:(NSRange){
|
||||
0,
|
||||
attrText.length
|
||||
}];
|
||||
[attrText addAttribute:NSStrokeColorAttributeName value:color range:(NSRange){
|
||||
0,
|
||||
attrText.length
|
||||
}];
|
||||
((UILabel*)self).attributedText = attrText;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user