I am downloading images from parse with file totes PNG and JPEG.
(我正在从解析器下载带有文件手提包PNG和JPEG的图像。)
When image is downloaded to the app I need to determine what the file type is so I can handle image accordingly.
(将图像下载到应用程序后,我需要确定文件类型是什么,以便可以相应地处理图像。)
Had a look at API for uiimageview and did a search but can't find any solution in swift.
(看过uiimageview的API并进行了搜索,但没有迅速找到任何解决方案。)
Any input appreciated
(任何输入表示赞赏)
Trying to get url from PFFIle §:
(尝试从PFFIle§获取网址:)
let imageURLFromParse = NSURL(string : caseImageFile2.url);
// Error here: 'NSURL?' does not have a member named 'pathExtension'
if(imageURLFromParse.pathExtension!.lowercaseString == ".jpg" || imageURLFromParse.pathExtension.lowercaseString == ".jpeg"){
println("Parse image ext is a jpg: (imageURLFromParse.pathExtension.lowercaseString)");
fileExtenion = ".jpg";
} else {
println("Parse image is a png: (imageURLFromParse.pathExtension.lowercaseString)");
fileExtenion = ".png";
}
ask by dancingbush translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…