I'm displaying a video output from device camera using AVCaptureVideoPreviewLayer
.
I would like to have an UILabel
and to fill its content with camera output, just like in the picture below:
I can't find something useful to achieve this, does someone know how to do this effect?
Try this code:
CATextLayer *label = [CATextLayer layer];
label.frame = self.cameraParentView.bounds;
label.foregroundColor = [UIColor blackColor].CGColor;
label.string = @"074";
label.font = (__bridge CFTypeRef)(@"Helvetica");
label.fontSize = 90;
label.alignmentMode = kCAAlignmentCenter;
label.wrapped = true;
label.contentsScale = [[UIScreen mainScreen] scale];
self.cameraLayer.layer.mask = label;