利用webview显示gif动画
CGRect frame =
CGRectMake(50,50,0,0);
frame.size = [UIImage
imageNamed:@"1.gif"].size;
//
读取gif图片数据
NSData *gif = [NSData
dataWithContentsOfFile: [[NSBundle
mainBundle] pathForResource:@"1"
ofType:@"gif"]];
// view生成
UIWebView *webView = [[UIWebView
alloc] initWithFrame:frame];
webView.userInteractionEnabled =
NO;//用户不可交互
[webView loadData:gif
MIMEType:@"image/gif"
textEncodingName:nil
baseURL:nil];
[self.view
addSubview:webView];
时间: 2024-12-19 08:50:14