ca-archived / iOS-NBUImagePicker

Modular image picker with Simulator-compatible AVFondation camera, assets library, filters and more.
http://cyberagent.github.io/iOS-NBUImagePicker
Apache License 2.0
193 stars 48 forks source link

It seems no way to preset flash mode for imagepicker. #2

Closed modenl closed 10 years ago

modenl commented 10 years ago

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

rivera-ernesto commented 10 years ago

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.

modenl commented 10 years ago

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.

rivera-ernesto commented 10 years ago

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.

modenl commented 10 years ago

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

rivera-ernesto commented 10 years ago

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.

modenl commented 10 years ago

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

rivera-ernesto commented 10 years ago

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

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