iOS中 动态启动图GIF的简单设置 韩俊强的博客

 // 设定位置和大小
    CGRect frame = CGRectMake(50,340,[UIScreen mainScreen].bounds.size.width / 2,[UIScreen mainScreen].bounds.size.height / 2);
    frame.size = [UIImage imageNamed:@"640gif.gif"].size;
//    frame.size.width = [UIImage imageNamed:@"启动页640.gif"].size.width / 2;
//    frame.size.height = [UIImage imageNamed:@"启动页640.gif"].size.height / 2;
    // 读取gif图片数据
    NSData *gif = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"640gif" 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];

上一篇:Kotlin高级函数map,flatMap,filter,take,let,apply,with,run,use等简单实用


下一篇:到处是map、flatMap,啥意思?