ca-archived/iOS-NBUImagePicker

It seems no way to preset flash mode for imagepicker.

Closed this issue · 7 comments

Didn't find how to set flash mode in ImagePicker for CameraViewController. Why not just take a parameter?

Actually there is one, but in NBUCameraView and not in the controller.

All functionality is in the view to make it more flexible, for instance to embed it inside your own controllers.

In contrast NBUCameraViewController simply passes some basic parameters to the view in viewDidLoad. I'm also looking for a better way to "forward" parameters instead of recreating all properties in the controller.

It means I cannot preset flash mode in NBUImagePicker. It has to be set after cameraview set its current device. But I cannot hook up my code to that point.

Sent from my iPhone

On Mar 2, 2014, at 16:41, Ernesto Rivera notifications@github.com wrote:

Actually there is one, but in NBUCameraView and not in the controller.

All functionality is in the view to make it more flexible, for instance to embed it inside your own controllers.

In contrast NBUCameraViewController simply passes some basic parameters to the view in viewDidLoad. I'm also looking for a better way to "forward" parameters instead of recreating all properties in the controller.


Reply to this email directly or view it on GitHub.

The problem is that it is not efficient to reproduce all NBUCameraView properties to the Camera Controller and then to the Picker, along Filter, Assets, Crop properties. Besides being cumbersome it would be terrible to maintain and keep in sync.

NBUImagePicker has many directly configurable NBUImagePickerOptions but for more customization you should subclass it and implement finishConfiguringControllers:.

There also this somewhat outdated customization guide that I'll try to update.

At the time finishConfiguringControllers: is called, cameraView is not created. So I cannot set flashmode.

One way to do it is to force Camera Controller to load its view:

if (self.cameraController.view) // This will force view's load
{
    self.cameraController.cameraView... // Camera view is now loaded and configurable
}

A cleaner way would be to subclass Camera Controller and override viewDidLoad to configure the Camera view there.

self.currentAVCaptureDevice is set in viewWillApear. Even I force cameraView loaded, currentDevice is nil. I still cannot set flashMode...

You're right. One more reason to subclass it to have full control of the Camera View.

  • Create an empty Storyboard.
  • Copy and paste the Camera Scene from NBUImagePicker Storyboard.
  • Change the class to your subclass, and modify anything you want there (colors, sizes, etc.).
  • Specify your customStoryboard when initializing the picker.

Again there are two many variables and properties to forward (and more importantly to maintain) to the controllers, so only a few are present.