原生应用 头像偶尔不显示,想着显示不出来的用http下载试一次 下载后转成的Uint8Array 放在cc.Texture2D initWithData里 显示出来的图像并不是想要的
这个是不是你想要的?
/**
加载网络图片
*/
static loadImgByUrl(imgNode, remoteUrl, imageType) {
remoteUrl = remoteUrl + ‘?’ + (new Date()).valueOf();
if (!imageType) {
imageType = “png”;
}
cc.loader.load({
url: remoteUrl,
type: imageType
}, function (err, texture) {
if (err) {
return;
}
imgNode.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
});
}
2.1版本的没有这个
不是的 用这个方法我的头像偶尔不显示
