Macã¨iPhoneã§ã¢ãã¡ã¼ã·ã§ã³GIFã表示ããæ¹æ³ã¾ã¨ã
ã¾ã¨ã¾ã£ã¦ããã¼ã¸ããªãããã ã£ãããã調ã¹ãäºãã¡ã¢ã
ã
Macã®å ´å
AppKitã®NSImageã使ãã°åæã«åãã
ãµã¤ãº17x17ãã³ãæ°3ãæç»æé1ã³ã辺ã0.1ç§ãã®GIFã表示ãããã®ã«ãCPUã1.5%ä½ä½¿ãç¶ããã
ã©ãããã¢ãã¡ã¼ã·ã§ã³GIFã®æç»ã¯éããããã
ã
iPhoneã®å ´å - è¤æ°ã®éæ¢ç»ãæå®ãã¦UIImageViewã§è¡¨ç¤º
NSImageã¨ä¼¼ããããªæãã§UIKitã«UIImageã¨ããã¯ã©ã¹ããããã©ãGIFã¯åããªãã
ãã®æ¹æ³ã¯ãè¤æ°ã®éæ¢ç»ãæéã§åãæ¿ãã¦ã¢ãã¡ã¼ã·ã§ã³ãããã
ã
ã¡ãªãã
ã»PNGçã®ãã©ã¼ãããã使ããã®ã§ãGIFã§ã¯è¡¨ç¾åºæ¥ãªãè²ã使ããã
ã
ãã¡ãªãã
ã»æ¢åã®GIFãã¡ã¤ã«ããã®ã¾ã¾ä½¿ãäºãåºæ¥ãªãã
ã
åèURL
[iPhone][tips] UIImageã§æã£åãæ©ãã¢ãã¡ã¼ã·ã§ã³ãä½ã£ã¦ãã¾ãæ¹æ³ - Ni chicha, ni limona - å¹³åããæããããªãå - iPhoneã¢ããªéçºã°ã«ã¼ã
http://iphone-dev.g.hatena.ne.jp/paella/20090924/1253764989
ã
iPhoneã®å ´å - 1ã¤ã®ã¢ãã¡ã¼ã·ã§ã³GIFãæå®ãã¦UIImageViewã§è¡¨ç¤º
ã¢ãã¡ã¼ã·ã§ã³GIFã®ãã¤ããªãã¼ã¿ãè§£æãã¦ãè¤æ°ã®UIImageãçæãã¦ã以ä¸åä¸ã
ã
ã¡ãªãã
ã»æ¢åã®GIFãã¡ã¤ã«ããã®ã¾ã¾ä½¿ãäºãåºæ¥ãã
ã
ãã¡ãªãã
ã»GIFãã¡ã¤ã«ã®ãã©ã¼ãããã«ãã£ã¦ã¯èæ¯è²ãå¤ã«ãªãäºãããã
ã»éåæã§çæããããããçæãçµããã¾ã§ç»åã®ãµã¤ãºãåå¾åºæ¥ãªãã
ã
ã½ã¼ã¹
- (void)viewDidLoad { NSString *path = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"aaa.gif"]; UIImage *img = [UIImage imageNamed:path]; path = [path stringByReplacingOccurrencesOfString:@"/" withString:@"//"]; path = [path stringByReplacingOccurrencesOfString:@" " withString:@"%20"]; NSURL *imgurl = [NSURL URLWithString: [NSString stringWithFormat:@"file:/%@", path]]; UIImageView *imageView = [AnimatedGif getAnimationForGifAtUrl:imgurl]; [imageView setFrame:CGRectMake(0.0, 0.0, img.size.width, img.size.height)]; [self.view addSubview:imageView]; }
ã
åèURL
[GIF][UIImageView] ã¢ãã¡ã¼ã·ã§ã³GIFãUIImageViewã§(ç¡çç¢ç)表示ãã - Ni chicha, ni limona - å¹³åããæããããªãå - iPhoneã¢ããªéçºã°ã«ã¼ã
http://iphone-dev.g.hatena.ne.jp/paella/20100105/1262705713
ã
iPhoneã®å ´å - 1ã¤ã®ã¢ãã¡ã¼ã·ã§ã³GIFãUIWebViewã§è¡¨ç¤º
Safariã®æ©è½ã使ã£ã¦è¡¨ç¤ºããã
ã
ã¡ãªãã
ã»æ¢åã®GIFãã¡ã¤ã«ããã®ã¾ã¾ä½¿ãäºãåºæ¥ãã
ã»Safariã§è¡¨ç¤ºåºæ¥ãGIFãã¡ã¤ã«ãªã確å®ã«è¡¨ç¤ºåºæ¥ãã
ã
ãã¡ãªãã
ã»ç»åã®ãµã¤ãºãåå¾åºæ¥ãªãã
ã»ä¸åº¦ã«å¤§éã«çæãããããã¨ãæç»ãããã¾ã§ã«æéããããã
ã»å¤§éã«addSubviewãã¦ãã¨CPUã使ãéãã¦ããã¼ã¸ã³ã°ãã¾ã¾ãªããªãä½éããï¼removeFromSuperviewããã°è»½ããªãï¼
ã
ã½ã¼ã¹
imgã¿ã°ã ãã®HTMLã表示ãããã®ã¨ãç»åURLãã表示ãããã®ãè¤æ°åæã«çæããæã®æç»æéãè¥å¹²éãæ°ãããã
å¤åãã¡ã¤ã³ã¹ã¬ãããéãããUIWebViewã®ã¹ã¬ãããéãããã®éããªããããªããã¨æãããã
ï¼HTMLã®èªã¿è¾¼ã¿ã¯éåæã§è¡ãããï¼
- (void)viewDidLoad { NSString *path = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"aaaa.gif"]; NSString *htmlSource = htmlSource = [NSString stringWithFormat:@"<img src='file://%@' />", path]; UIImage *img = [UIImage imageNamed:path]; UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(-8, -8, img.size.width+8, img.size.height+8)]; [webView loadHTMLString:htmlSource baseURL:nil]; [self.view addSubview:webView]; [webView release]; }
ã
åèURL
iPhoneãã¤ãã£ãã¢ããªã§ã¢ãã¡ã¼ã·ã§ã³GIFã表示ããæ¹æ³ -
ãã®ããã°ã¯è¨¼æã§ããªãã
http://d.hatena.ne.jp/shunsuk/20090915/1253005008
ã
iPhoneã®å ´å - 1ã¤ã®ã¢ãã¡ã¼ã·ã§ã³GIFãUIWebBrowserViewã§è¡¨ç¤º
UIWebViewã®ä¸ããå¿
è¦ãªView1ã¤ã ããåã£ã¦ããã
ã
ã¡ãªãã
ã»æ¢åã®GIFãã¡ã¤ã«ããã®ã¾ã¾ä½¿ãäºãåºæ¥ãã
ã»Safariã§è¡¨ç¤ºåºæ¥ãGIFãã¡ã¤ã«ãªã確å®ã«è¡¨ç¤ºåºæ¥ãã
ã»UIWebViewã§è¡¨ç¤ºãããã軽ãã
ã
ãã¡ãªãã
ã»ç»åã®ãµã¤ãºãåå¾åºæ¥ãªãã
ã»Appleã«ç³è«ãã¦ã審æ»ãéãã䏿ãï¼äººæ±åéä¸ï¼
ã»ä»å¾ã®iOSã®ãã¼ã¸ã§ã³ãä¸ãã£ã¦ã使ããã¨ããä¿è¨¼ããªãã
ã
ã½ã¼ã¹
- (void)viewDidLoad { NSString *path = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"aaaa.gif"]; NSString *htmlSource = htmlSource = [NSString stringWithFormat:@"<img src='file://%@' />", path]; UIImage *img = [UIImage imageNamed:path]; self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(-8, -8, img.size.width+8, img.size.height+8)]; [webView loadHTMLString:htmlSource baseURL:nil]; id browserView = [[[[webView subviews] lastObject] subviews] lastObject]; [browserView setFrame:CGRectMake(-8, -8, img.size.width+8, img.size.height+8)]; [self.view addSubview:browserView]; }
ã
åèURL
ãã¥ã¼ (UIView) ã®é層æ§é ããã³ãããéå
¬éã®ä¾¿å©ã¡ã½ãã - 24/7 twenty-four seven
http://d.hatena.ne.jp/KishikawaKatsumi/20100521/1274451944