iPhone ã§ç”»é¢ã‚¤ãƒ¡ãƒ¼ã‚¸ã‚’å–å¾—ã™ã‚‹
å‰å›žã¨ä¼¼ãŸãƒã‚¿ã€‚
#import <QuartzCore/QuartzCore.h> - (UIImage*) buildImageFrom: (UIView*)view { UIGraphicsBeginImageContext(view .bounds.size); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return viewImage; }
ã“ã®ã¨ãã€å–å¾—ã§ãã‚‹ UIImage 㯠autorelease 済ã¿ãªã®ã§ã€ release ã™ã‚‹ã¨æ»ãる。
今回ã¯å…¬å¼å…¬é–‹ã® API ãªã®ã§ã€èƒ¸ã‚’å¼µã£ã¦ Apple ã«å‡ºã›ã‚‹ãªã€‚
import ã¯ã‚ã£ã¦ã‚‚ãªãã¦ã‚‚よã„*1。
*1:ç„¡ã„å ´åˆã¯ã€renderInContext 㧠warning ãŒå‡ºã‚‹