如何在uiwebview ios swift上显示照片库中的图像?

时间:2022-08-24 23:22:21

Using Photos API(PHImageManager) i am able to get list of photos url and photo object. When I am trying to use that url in webview , image is not displaying

使用照片API(PHImageManager)我能够获得照片网址列表和照片对象。当我尝试在webview中使用该URL时,图像不会显示

Consider the following image url which I got from Photos API(PHImageManager)

考虑我从Photos API(PHImageManager)获得的以下图像网址

1 个解决方案

#1


0  

you just have to take that burl in string and then load that string in webview in viewdidload

你只需要在字符串中获取该字符串,然后在viewdidload中将该字符串加载到webview中

like

urlStr = obj["url"] as! String

urlStr = obj [“url”] as!串

and then load that url in uiwebview

然后在uiwebview中加载该URL

webview.loadRequest(NSURLRequest(URL: NSURL(string: urlStr)!))

webview.loadRequest(NSURLRequest(URL:NSURL(string:urlStr)!))

#1


0  

you just have to take that burl in string and then load that string in webview in viewdidload

你只需要在字符串中获取该字符串,然后在viewdidload中将该字符串加载到webview中

like

urlStr = obj["url"] as! String

urlStr = obj [“url”] as!串

and then load that url in uiwebview

然后在uiwebview中加载该URL

webview.loadRequest(NSURLRequest(URL: NSURL(string: urlStr)!))

webview.loadRequest(NSURLRequest(URL:NSURL(string:urlStr)!))