您的位置:首页 > 其它

显示 GIF 图片

2015-09-08 17:52 246 查看
// 用 uiwebimage
来显示 gif 图片

//
设定位置和大小

CGRect frame = CGRectMake(50,500,0,0);

frame.size = [UIImage
imageNamed:@"1440470244396823.gif"].size;

//
读取gif图片数据

NSData *gif = [NSData
dataWithContentsOfFile: [[NSBundle
mainBundle] pathForResource:@"1440470244396823"
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];
[webView
release];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: