繁体   English   中英

cameraOverlayView在UIImagePickerController中裁剪结果

[英]cameraOverlayView to crop the result in UIImagePickerController

当我使用带有cameraOverlayView UIImagePickerController时,我可以从叠加视图中获得唯一的选区吗?

http://tinyurl.com/2fqy9nq

  1. 将UIImageView作为子项添加到cameraOverlayView。
  2. 创建黑色PNG图像大小320x480。 在中间切一个矩形以产生一个洞(透明像素)。
  3. 将PNG图像分配给UIImageView。

或者你可以像这样覆盖你的cameraOverlayView's - (void)drawRect:(CGRect)rect (我的头脑中未经测试):

// 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);

我在Faces应用程序( http://faces.pixelshed.net/ )中做了类似的事情。 如果其中一个步骤似乎不清楚,请随意写评论。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM