mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
fix: UIImage leaking after Image is disposed
This commit is contained in:
@ -24,6 +24,21 @@ export class Image extends ImageBase {
|
|||||||
this._setNativeClipToBounds();
|
this._setNativeClipToBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public disposeNativeView(): void {
|
||||||
|
super.disposeNativeView();
|
||||||
|
|
||||||
|
if (this.imageSource?.ios) {
|
||||||
|
// release the native UIImage
|
||||||
|
CFRelease(this.imageSource.ios);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.imageSource = null;
|
||||||
|
|
||||||
|
if (this.nativeViewProtected?.image) {
|
||||||
|
this.nativeViewProtected.image = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private setTintColor(value: Color) {
|
private setTintColor(value: Color) {
|
||||||
if (value && this.nativeViewProtected.image && !this._templateImageWasCreated) {
|
if (value && this.nativeViewProtected.image && !this._templateImageWasCreated) {
|
||||||
this.nativeViewProtected.image = this.nativeViewProtected.image.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
|
this.nativeViewProtected.image = this.nativeViewProtected.image.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
|
||||||
|
Reference in New Issue
Block a user