Take photos using volume buttons - iphone

Is it possible to take photos using the volume controls on the iPhone?
Ideally, the takePicture() method would be called when the volume button is pressed.

Add an event listener.
Titanium.Media.addEventListener('volume', function(e) {
Ti.Media.takePicture();
});
Make sure the event listener is added when the camera is already shown. Docs here: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Media-method-takePicture

Old, but still relevant: program access to iPhone volume buttons
Also consider adding better tags to your question, objective c, ios, xcode, etc.

Related

Method for using volume up button to take pictures iPhone

Is there a method to call to be able to enable/disable the feature of taking pictures with the volume up button?
I have noticed that using imagePicker.showsCameraControls=NO; and by setting a custom overlay of the cameraOverlayView of the UIImagePickerController, the volume button is disabled. Now the problem is that you have to redefine the behaviors of the camera(zoom, ect).
Short of jailbreaking your device or using private api, this cannot be done, much less approved by Apple, using the standard methods.
If your device is jailbroken, I believe there is an Activator setting that will allow you to accomplish this.
Also, there is a package in Cydia that does exactly this called SnapTap.

iPhone keyboard return key

I need to customize the iphone keyboard. How can I do it? Also it is needed to place the return key of the keyboard with my project logo. How is it possible?
You cannot customize the apple iOS's default keyboard.
As such you can create a custom control similar to apple iOS's keyboard and make it look and customize as you want but then there ar more chances than not that your app may be rejected when you try to submit your app on the Apple's app store.
So it is not preferable to create custom keyboard.
Hope this helps you.
What have we done in one of our apps and you can do is create custom uibutton that is same size as return key, then register for UIKeyboardWillShowNotification and UIKeyboardWillHideNotification.
when one of those fire you should add/remove that uibutton to window with animation that tracks keyboard showing/hiding animation...
Ugly way to do it, but it served its purpose...
Some of the tutorials are incomplete or are much older. This tutorial works from IOS 4.3 onwards and I checked it. Save the two image graphics, and paste in the code. There is very little to change. Here is the link.
ps. I am not affiliated in any way with this article, but found it to be complete.
http://www.neoos.ch/blog/37-uikeyboardtypenumberpad-and-the-missing-return-key

iPhone volume changed event for volume already max

I'm using
AudioSessionAddPropertyListener(kAudioSessionProperty_CurrentHardwareOutputVolume,
audioVolumeChangeListenerCallback, self);
to detect volume changes so i can take a picture with the volume rockers but if the phone is already at 100% i don't get an event. Is there a way to detect volume rocker pressed when the volume doesn't actually change?
I found a good answer with full source code here:
When the user presses the volume buttons in your app, you don’t want
the system volume to change. It would suck to have them taking
pictures and turn up their ringtone volume all the way or something.
So how do I pull that off? This is pretty hacky but it works.
Well you could set the volume lower after you've registered a volume button press to take a picture. That way the volume never reaches 100% and you can continue getting callbacks. Make sure to lower the volume by more than the volume changes in a single press of the volume button.
You will want to be careful to use some method to prevent receiving multiple notifications at once, but you are likely already doing that if you only take one photo per "button press".
I think I'm going to implement this feature (didn't think it was needed, but now I like the idea) in my app, and I'll post some code if I get it working, let me know if you get yours working as well.

Taking images from camera without user interaction?

I am creating an app in which, as soon as the UIImagePickerController loads (i.e. the camera view), it should start taking pictures without any click and store images in an array. How can I do this without clicking on the "shoot" button?
In reference library, UIImagePickerController contains an instance method, -takePicture. Can somebody tell me if this function will do the trick, if I call it through timer?
Thanks in advance.
-takePicture should do the trick in deed. You have to provider a custom UI for the camera controls, because otherwise (for me) it doesn't work. Check out the developer documentation in Xcode and search for takePicture. The method description has everything you need.

iPhone - UIImagePickerController - How to allow user to pick the source?

I'm writing an application that uses UIImagePickerController. I'd like to give users choice of source of pictures, either take a new photo or choose from existing ones. I'd like to create exactly the same selection interface as is in twitterfon or in safari when you hold tap on the link. It looks like some standard SDK thing but I have completely no clue where to find some sample code. I've googled for hours and I have nothing.
I would really appreciate any tips.
Thank you
What you're looking for is the UIActionSheet. The documentation has everything you need to set one up and how to respond to which button is pressed.
You'll also want to use the constants defined for the UIImagePickerController sources, namely
UIImagePickerControllerSourceTypeCamera
UIImagePickerControllerSourceTypePhotoLibrary
That would be an UIActionSheet. Make sure to point its delegate property to your implementation of the UIActionSheetDelegate protocol to catch clicks on the buttons you define.