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=\"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];

 

posted @ 2014-06-19 15:51  Qiang zi  阅读(205)  评论(0编辑  收藏  举报