画像をUIImageに
UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, [[UIScreen mainScreen] scale]); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0, 0); CGContextScaleCTM(context, 1.0, 1.0); [self.layer renderInContext:context]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image;
背景を塗っておかないと変になる。