Fit image of random size into a UIWebview (IOS)

后端 未结 4 660
名媛妹妹
名媛妹妹 2020-12-10 08:26

\"\"

I want to fit large image into UIwebview with keeping image ratio same as image view.

How can i do

4条回答
  •  抹茶落季
    2020-12-10 08:54

    To load image in Swift 3.0 from application document directory in a UIWebView with his expected ratio -

    if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
                let path = dir.appendingPathComponent(imageName)
                
                
                
            let fullHTML = "" +
                "" +
                "" +
                "" +
                "" +
                "" +
                "" +
                " "
                
                imgWbView.loadHTMLString(fullHTML, baseURL: nil)
    }

提交回复
热议问题