IPhone 5 low-light mode

Has anyone been able to get a new iPhone 5 backlight mode to work in a custom camera application? I tried the following code, but did not notice any difference - while the camera’s own application significantly increased brightness.

if ([[captureManager backFacingCamera] isLowLightBoostEnabled]) {

    [[captureManager backFacingCamera] automaticallyEnablesLowLightBoostWhenAvailable];
}
+2
source share
1 answer

You need lockForConfiguration, according to the docs (well, the header file):

if ([[self backFacingCamera] respondsToSelector:@selector(isLowLightBoostSupported)]) {
  if ([[self backFacingCamera] lockForConfiguration:nil]) {
    if ([self backFacingCamera].isLowLightBoostSupported)
      [self backFacingCamera].automaticallyEnablesLowLightBoostWhenAvailable = YES;
    [[self backFacingCamera] unlockForConfiguration];
  }
}

It also isLowLightBoostEnabledtells you whether low light is actually being activated, and not whether it can be. This is a selector isLowLightBoostSupportedas described above (which only iOS 6 devices respond to).

+5
source

Source: https://habr.com/ru/post/1532348/


All Articles