iOS 背景动态图

来源:互联网 发布:cntv中国网络电视台5 编辑:程序博客网 时间:2024/05/16 01:26

1 可以使用uiimageView ,获取GIF 的帧数,然后用进行轮播,由于个人觉得用法比较麻烦,就不详细介绍了,可以自行百度,文章很多

2 是用uiwebView 进行加载

详细介绍:

1 将动态的DIF格式图拖到工程中

2 然后创建一个uiwebView

3 加载GIF图 ,转化为data

代码:  


 NSString *filePath = [[NSBundle mainBundle] pathForResource:@"抽屉4" ofType:@"gif"];    NSData *gif = [NSData dataWithContentsOfFile:filePath];    UIWebView *web = [[UIWebView  alloc] initWithFrame:self.view.bounds];    [web  loadData:gif MIMEType:@"image/gif" textEncodingName:@"" baseURL:nil];        [self.view  addSubview:web];    

    



0 0
原创粉丝点击