首页 > 代码库 > UIWebView显示gif类型图片

UIWebView显示gif类型图片

 NSData *gifFile = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"text" ofType:@"gif"]];    _mywebview.scalesPageToFit = YES;    [_mywebview loadData:gifFile MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];

  html

      NSString *html = @"<html><head><body><img src=http://www.mamicode.com/"text.gif\"><body></head></html>";    NSString *path = [[NSBundle mainBundle] resourcePath];    NSURL *baseURL = [NSURL fileURLWithPath:path];    //_mywebview.scrollView.bounces = NO;    _mywebview.scalesPageToFit = YES;    //_mywebview.scrollView.scrollEnabled = NO;    [_mywebview loadHTMLString:html baseURL:baseURL];