iOS加载gif动画

//设定位置和大小

CGRectframe =CGRectMake(0,0,[UIScreenmainScreen].bounds.size.width,[UIScreenmainScreen].bounds.size.height);

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

//读取gif图片数据

NSData*gif = [NSDatadataWithContentsOfFile: [[NSBundlemainBundle]pathForResource:@"1111"ofType:@"gif"]];

// view生成

UIWebView*webView = [[UIWebViewalloc]initWithFrame:frame];

webView.userInteractionEnabled=NO;//用户不可交互

[webViewloadData:gifMIMEType:@"image/gif"textEncodingName:nilbaseURL:nil];

[self.viewaddSubview:webView];

你可能感兴趣的:(iOS加载gif动画)