UIWebView加载本地gif

 用UIWebView加载本地gif,png的试了不行,其他格式的没有试。

可以显示动态的图片

代码很简单如下:

    NSString *html = @"<html><head><body><img src=\"diablo.gif\"><body></head></html>";
    NSString *path = [[NSBundle mainBundle] resourcePath];
    NSURL *baseURL = [NSURL fileURLWithPath:path];
    [webImage loadHTMLString:html baseURL:baseURL];

把其中的diablo.gif换成你想加载的gif图片就可以了,webImage是UIWebView的对象。

 
 
原文地址:https://www.cnblogs.com/xiaobaizhu/p/2798168.html