Post

Replies

Boosts

Views

Activity

How do you resize the gif displayed in WKWebView
I want to display a gif that it fits in WKWebView. (like Aspect fit.) gif is stored locally. This is sample code and Autolayout.↓ import UIKit import WebKit class ViewController: UIViewController {   @IBOutlet weak var webView: WKWebView!       override func viewDidLoad() {     super.viewDidLoad()           guard let url = Bundle.main.url(forResource: "sample", withExtension: "gif"),        let data = try? Data(contentsOf: url),        let baseURL = Foundation.URL(string: "about:blank") else {       return     }     webView.load(data, mimeType: "image/gif", characterEncodingName: "UTF-8", baseURL: baseURL)         } } use the gif from this link.↓ https://sozai-good.com/illust/animal/5677 When run this code, the gif is cut off. (use iPhone13 pro) How do you resize the gif?
1
0
1.3k
Aug ’22