Tôi đang sao chép ứng dụng máy ảnh của Apple bằng AVCaptureSession dựa trên mẫu ứng dụng AppCam của Apple. Vấn đề là tôi không thể nhìn thấy hình chữ nhật lấy nét trong màn hình xem trước video. Tôi đã sử dụng mã sau để đặt tiêu điểm, nhưng hình chữ nhật tiêu điểm vẫn không được hiển thị.máy ảnh iphone hiển thị hình chữ nhật lấy nét
AVCaptureDevice *device = [[self videoInput] device];
if ([device isFocusModeSupported:focusMode] && [device focusMode] != focusMode) {
NSError *error;
printf(" setFocusMode \n");
if ([device lockForConfiguration:&error]) {
[device setFocusMode:focusMode];
[device unlockForConfiguration];
} else {
id delegate = [self delegate];
if ([delegate respondsToSelector:@selector(acquiringDeviceLockFailedWithError:)]) {
[delegate acquiringDeviceLockFailedWithError:error];
}
}
}
Khi tôi sử dụng UIImagePickerController, tiêu điểm tự động, nhấn lấy nét được hỗ trợ theo mặc định và có thể nhìn thấy hình chữ nhật tiêu điểm. Không có cách nào để hiển thị hình chữ nhật tiêu điểm trong lớp xem trước video bằng AVCaptureSession?
hmm, có vẻ như không ai biết thi S. – ttotto