1
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array/>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"deploymentTarget": "12",
|
||||
"dependencies-pods": [{
|
||||
"name": "SVGKit",
|
||||
"version": "3.0.0"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
UIButton,
|
||||
UIControl,
|
||||
UIImageView,
|
||||
UIImage
|
||||
} from "UIKit"
|
||||
import { SVGKImage } from "SVGKit" assert { type: "implementationOnly" };
|
||||
import { UTSComponent } from "DCloudUTSFoundation"
|
||||
import { Data } from 'Assignables';
|
||||
import { CALayer } from 'QuartzCore';
|
||||
import { CGRect, CGSize } from 'CoreFoundation';
|
||||
|
||||
|
||||
|
||||
export class xSvgU {
|
||||
$element : UniNativeViewElement;
|
||||
targetView : UIImageView | null = null;
|
||||
constructor(element : UniNativeViewElement) {
|
||||
this.$element = element;
|
||||
this.targetView = new UIImageView()
|
||||
this.$element.bindIOSView(this.targetView!);
|
||||
}
|
||||
|
||||
setImage(newval : string) {
|
||||
if (newval != '') {
|
||||
let url = UTSiOS.getResourcePath(newval)
|
||||
// let width = (16).toInt();
|
||||
// let height = (16).toInt();
|
||||
// this.targetView!.frame = new CGRect(x = 0, y = 0, width = width, height = height);
|
||||
const size:CGRect = this.targetView!.frame;
|
||||
let svgURL = new URL(fileURLWithPath = url)
|
||||
let svgData = UTSiOS.try(new Data(contentsOf = svgURL),"?")
|
||||
if(svgData==null) return;
|
||||
let svgImage = new SVGKImage(data = svgData!)
|
||||
svgImage!.size = new CGSize(width= size.width, height= size.height)
|
||||
this.targetView!.image = svgImage?.uiImage
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user