Я уже давно работаю над проектом, и я пришел к одной вещи, над которой хочу по-настоящему разобраться, что я не смог понять.Фронт Яркость вспышки iPhone
В приложении, когда вы делаете переднюю фотографию, я бы хотел, чтобы передняя вспышка делала изображение ярче.
Я использую пользовательскую камеру AVCaptureSession, это полный экран. Вот код, который делает вспышку, только картина не ярче вообще.
//Here is the code for a front flash on the picture button press. It does flash, just doesn't help.
UIWindow* wnd = [UIApplication sharedApplication].keyWindow;
UIView *v = [[UIView alloc] initWithFrame: CGRectMake(0, 0, wnd.frame.size.width, wnd.frame.size.height)];
[wnd addSubview: v];
v.backgroundColor = [UIColor whiteColor];
[UIView beginAnimations: nil context: nil];
[UIView setAnimationDuration: 1.0];
v.alpha = 0.0f;
[UIView commitAnimations];
//imageView is just the actual view the the cameras image fills.
imageView.hidden = NO;
AVCaptureConnection *videoConnection = nil;
for (AVCaptureConnection *connection in stillImageOutput.connections) {
for(AVCaptureInputPort *port in [connection inputPorts]) {
if ([[port mediaType] isEqual:AVMediaTypeVideo]) {
videoConnection = connection;
break;
}
}if (videoConnection) {
break;
}
} [stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer != NULL) {
imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *thePicture = [UIImage imageWithData:imageData];
self.imageView.image = thePicture;
//After the picture is on the screen, I just make sure some buttons are supposed to be where they are supposed to be.
saveButtonOutlet.hidden = NO;
saveButtonOutlet.enabled = YES;
diaryEntryOutlet.hidden = YES;
diaryEntryOutlet.enabled = NO;
}
}];
}
Почему вы установка альфа в 0 (прозрачные)? – Paulw11
@ Paulw11 да, иначе белое окно останется белым навсегда. –
Почему бы не просто установить цвет фона на 'clearColor'? Вы уверены, что ваш белый экран правильно синхронизирован с вашим захватом изображения? – Paulw11