目前我有分割,我想把它分成两个不同的图像。
我目前正在使用它,但它没有正确获取帧。
// @property of UIImage
self.splitImage = [_displayLastPhoto image];
NSLog(@"Split image %f %f", self.splitImage.size.width, self.splitImage.size.height);
[self setViewShow:self.successfulMessage];
CGImageRef tmpImgRef = self.splitImage.CGImage;
CGImageRef leftImgRef = CGImageCreateWithImageInRect(tmpImgRef, CGRectMake(0, 0, self.splitImage.size.width / 2.0, self.splitImage.size.height));
UIImage *leftImage = [UIImage imageWithCGImage:leftImgRef];
NSLog(@"Left image %f %f", leftImage.size.width, leftImage.size.height);
CGImageRelease(leftImgRef);
CGImageRef rightImgRef = CGImageCreateWithImageInRect(tmpImgRef, CGRectMake(self.splitImage.size.width / 2.0, 0, self.splitImage.size.width / 2.0, self.splitImage.size.height));
UIImage *rightImage = [UIImage imageWithCGImage:rightImgRef];
NSLog(@"Right image %f %f", rightImage.size.width, rightImage.size.height);
CGImageRelease(rightImgRef);
所以现在右侧图像+左侧图像宽度应该等于_displayLastPhot
的宽度。但它不是。
编辑我硬编码宽度和高度以匹配_displayLastPhoto
宽度和高度,并匹配。但左右图像看起来非常放大。
答案 0 :(得分:0)
我肯定会这样做: