// 设定Frame
CGRect frame = CGRectMake(100,200,[UIScreen mainScreen].bounds.size.width / 2,[UIScreen mainScreen].bounds.size.height / 2);
frame.size = [UIImage imageNamed:@"640gif.gif"].size;
// frame.size.width = [UIImage imageNamed:@"Hot_2.gif"].size.width / 2;
// frame.size.height = [UIImage imageNamed:@"Hot_2.gif"].size.height / 2;
// 读取gif图片数据
NSData *gif = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Hot_1.gif" 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];
动态GIF图片的设计
最新推荐文章于 2021-03-21 14:54:34 发布