UIWebView显示gif类型图片

it2022-05-09  22

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];

 

转载于:https://www.cnblogs.com/KingQiangzi/p/3796803.html


最新回复(0)