Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone cameraOverlayView在UIImagePickerController中裁剪结果_Iphone_Uiimagepickercontroller_Ios - Fatal编程技术网

Iphone cameraOverlayView在UIImagePickerController中裁剪结果

Iphone cameraOverlayView在UIImagePickerController中裁剪结果,iphone,uiimagepickercontroller,ios,Iphone,Uiimagepickercontroller,Ios,当我将UIImagePickerController与cameraOverlayView一起使用时,我是否可以从覆盖视图中获取唯一的选择区域 将UIImageView作为子视图添加到cameraOverlayView 创建大小为320x480的黑色PNG图像。在中间切成一个矩形以产生一个孔(透明像素)。 将PNG图像指定给UIImageView 或者,您可以像这样覆盖cameraOverlayView的-(void)drawRect:(CGRect)rect(未经我的测试): 我在Faces应

当我将
UIImagePickerController
cameraOverlayView
一起使用时,我是否可以从覆盖视图中获取唯一的选择区域

  • 将UIImageView作为子视图添加到cameraOverlayView
  • 创建大小为320x480的黑色PNG图像。在中间切成一个矩形以产生一个孔(透明像素)。
  • 将PNG图像指定给UIImageView
  • 或者,您可以像这样覆盖cameraOverlayView的
    -(void)drawRect:(CGRect)rect
    (未经我的测试):


    我在Faces应用程序()中也做了类似的操作。如果其中一个步骤不清楚,请随时写评论。

    哪一类是cameraoverlayview?@Phil:
    cameraoverlayview
    是图像选择器控制器的属性,仅作为
    UIView
    公开:
    // Request draw context
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    // Draw background        
    CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 1.0f);
    CGContextFillRect(context, rect);
    
    // Cut hole
    CGContextSetBlendMode(context, kCGBlendModeClear);
    CGContextFillRect(context, CGRectMake(40, 40, 100, 100);