我正在开发一个应用程序,我需要使用红线将图像分成两部分.
正确的价格部分

问题1.
如何在图像上画一条红线?
问题2.
如何使用红线将图像分成两部分?(红线位置不固定.用户可以在任何地方移动位置)
问题3.
如何获得线当前位置以及如何使用该位置两个分割图像
提前致谢
对于作物你可以尝试这个,
UIImage *image = [UIImage imageNamed:@"yourImage.png"];
CGImageRef tmpImgRef = image.CGImage;
CGImageRef topImgRef = CGImageCreateWithImageInRect(tmpImgRef, CGRectMake(0, 0, image.size.width, image.size.height / 2.0));
UIImage *topImage = [UIImage imageWithCGImage:topImgRef];
CGImageRelease(topImgRef);
CGImageRef bottomImgRef = CGImageCreateWithImageInRect(tmpImgRef, CGRectMake(0, image.size.height / 2.0, image.size.width, image.size.height / 2.0));
UIImage *bottomImage = [UIImage imageWithCGImage:bottomImgRef];
CGImageRelease(bottomImgRef);
Run Code Online (Sandbox Code Playgroud)
希望这可以帮到你, :)
| 归档时间: |
|
| 查看次数: |
718 次 |
| 最近记录: |