UIWebView动态展示gif gif图不适应控件大小
2018-10-18 本文已影响0人
精神薇
CGRect frame = CGRectMake(0,[[UIApplication sharedApplication] statusBarFrame].size.height+44,350,350);
// view生成
UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
webView.backgroundColor = [UIColor redColor];
webView.userInteractionEnabled = NO;//用户不可交互
NSURL *url = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"NeuRecord.bundle/1" ofType:@"gif"]];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[webView setScalesPageToFit:YES];//自动适应当前frame大小
[self.view addSubview:webView];