Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
modenl opened this issue Mar 1, 2014 · 7 comments
Closed

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

modenl opened this issue Mar 1, 2014 · 7 comments

Comments

@modenl
Copy link

modenl commented Mar 1, 2014

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

@rivera-ernesto
Copy link
Contributor

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
Copy link
Author

modenl commented Mar 3, 2014

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
Copy link
Contributor

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
Copy link
Author

modenl commented Mar 25, 2014

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

@rivera-ernesto
Copy link
Contributor

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
Copy link
Author

modenl commented Mar 25, 2014

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

@rivera-ernesto
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants