UIWebView控件

#import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

 - (void)viewDidLoad {

    [super viewDidLoad];

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"动画" ofType:@"gif"];

    NSData *gif = [NSData dataWithContentsOfFile:filePath];

    UIWebView *webViewBG = [[UIWebView alloc] initWithFrame:self.view.frame];

    [webViewBG loadData:gif MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];

   // [webViewBG loadData:gif MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];

    

    webViewBG.userInteractionEnabled = NO;

    

    [self.view addSubview:webViewBG];

    UIView *filter = [[UIView alloc] initWithFrame:self.view.frame];

    

    filter.backgroundColor = [UIColor blackColor];

    

    filter.alpha = 0.05;

    

    [self.view addSubview:filter];

}

原文地址:https://www.cnblogs.com/hsxblog/p/4923880.html