使用分频器将图像分成两部分

Kir*_*ela 7 iphone ios ios6

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

  1. 左边标签
  2. 正确的价格部分

    在此输入图像描述

问题1.

如何在图像上画一条红线?

问题2.

如何使用红线将图像分成两部分?(红线位置不固定.用户可以在任何地方移动位置)

问题3.

如何获得线当前位置以及如何使用该位置两个分割图像

提前致谢

Sha*_*dul 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)

希望这可以帮到你, :)