动态GIF图片的设计

来源:互联网 发布:孔凤春马齿苋水 知乎 编辑:程序博客网 时间:2024/05/02 04:53
 // 设定Frame      CGRect frame = CGRectMake(100,200,[UIScreen mainScreen].bounds.size.width / 2,[UIScreen mainScreen].bounds.size.height / 2);      frame.size = [UIImage imageNamed:@"640gif.gif"].size;  //    frame.size.width = [UIImage imageNamed:@"Hot_2.gif"].size.width / 2;  //    frame.size.height = [UIImage imageNamed:@"Hot_2.gif"].size.height / 2;      // 读取gif图片数据      NSData *gif = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Hot_1.gif" 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];
0 0
原创粉丝点击