Take a picture on iPhone without showing controls
Yes, there are two ways to do this. One, available in iOS 3.0+ is to use the UIImagePickerController
class, setting the showsCameraControls
property to NO, and setting the cameraOverlayView
property to your own custom controls. Two, available in iOS 4.0+ is to configure an AVCaptureSession
, providing it with an AVCaptureDeviceInput
using the appropriate camera device, and AVCaptureStillImageOutput
. The first approach is much simpler, and works on more iOS version, but the second approach gives you much greater control over photo resolution and file options.
Taking picture by pressing button, without camera display
Yes, you do have that option but you have to do it the hard way, using the AV Foundation Media Capture methods instead of the much simpler UIImagePickerController. It is a bit complicated, but Apple has some resources to help:
AV Foundation Programming Guide - Media Capture has some information about how you go about this along with sample code snippets (just don't implement the preview portion).
The AVCam sample project shows how to implement all of the methods required to do this. You will need to modify this by removing the preview window and also tweak it if you want to run it on the iPad (they don't properly implement rotation for the iPad in this project).
Those two resources should be a very good starting point for you.
Also, I have not tested the code but this SO answer provides an example of using AV Foundation to capture a photo, and it doesn't provide a preview window.
Take photo without camera application
From your brief description and constraints, of course it's possible.
My assumptions are:
- That you want to do this from your own app, and not somehow launch Camera.app or Photos.app.
- The app is running (I haven't tried this from the background).
Simply have your AVCaptureDevice requestAccessForMediaType:
for AVMediaTypeAudio
(required) and AVMediaTypeVideo
(required in some regions). You can then use that to take video recordings and photos (you only need the audio if you're doing A/V recordings). If you want to save the captures to Photos.app albums, the user will have to allow that as well. In all cases, the user will be presented with the choice to allow the app access to the camera (+mic) hardware or the photos album -- if any are denied, the app will not be able to capture recordings, nor save to Photos' albums, respectively.
You're going to (obviously) lose the ability to have the user touch the screen to focus on a point of interest, or other features that demand a user interface.
If you are just interested in capturing still photos, start your documentation reading at AVCaptureStillImageOutput
, specifically captureStillImageAsynchronouslyFromConnection:completionHandler:
.
Ignore the fear mongering in the comments above -- you will have to ask the user for permission regardless, there is no way to do this in a 100% hidden fashion.
Having said that, you also must comply with the App Store Review Guidelines, and I'm guessing specifically the sections on privacy, media content, and legal requirements.
And, most importantly:
We will reject Apps for any content or behavior that we believe is over the line. What line, you ask? Well, as a Supreme Court Justice once said, "I'll know it when I see it". And we think that you will also know it when you cross it.
In this case, I think that means: don't be a jerk.
iOS take photo from camera without modalViewController
You can use AVFoundation for take photos. Read apple's documentation about it : AVCaptureDevice
Here is a sample code by apple. AVCam
Here I found a tutorial: link
Another stackOverflow question, and in this there is a good sample code I think: link
Another useful link for you: link
UIImagePickerController avoiding the use/retry view after picture taken without disabling other controls
Unfortunately there is no proper way to do this provided by Apple. So here are you options:
- showCameraControls = NO and adding your own controls.
- go hardcore and use AVFoundation - but again you'll need your own controls - probably not what you're looking to do but if you're interested I have a sample app of this here:
https://github.com/Shein/CameraFeedUnderlay
- Hack around it - place YOUR OWN button on top of camera control play button and override the action to take the picture as you would without camera controls and directly dismiss the UIImagePickerController.
There's a sort-of example of this solution here:
iPhone SDK - How to disable the picture preview in UIImagePickerController?
Capture photo without camera view in iOS
So here is the reference https://developer.apple.com/library/mac/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html#//apple_ref/doc/uid/TP40010188-CH5-SW2
To manage the capture from a device such as a camera or microphone,
you assemble objects to represent inputs and outputs, and use an
instance of AVCaptureSession to coordinate the data flow between them.
Take picture and set it to UIImageView in iOS
What you need to do is , Add a button first, with the title "Add Photo" or with custom image.
Then on the click of the button add the following code :
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)
return NO;
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController: cameraUI animated: YES completion:nil];
It will open up the camera, then you click the image and then tap "use" and You have to implement the UIImagePickerControllerDelegate method imagePickerController:didFinishPickingMediaWithInfo: and then store the UIImage to wherever you want, with whatever file name you want, using NSFileManager methods.
Related Topics
iOS Autolayout: Two Buttons of Equal Width, Side by Side
Uiview Vertical Flip Animation
How to Make iPhone Vibrate Using Swift
How to Display the Default iOS 6 Share Action Sheet with Available Share Options
Ask for User Permission to Receive Uilocalnotifications in iOS 8
Xcode 8.3/Xcode 9.0 Refresh Provisioning Profile Devices
Is There a Public Way to Force Mpnowplayinginfocenter to Show Podcast Controls
Completion Handler for Uinavigationcontroller "Pushviewcontroller:Animated"
Notificationcenter Issue on Swift 3
How to Draw Border Around a Uilabel
Xcode 8/Swift 3: "Expression of Type Uiviewcontroller? Is Unused" Warning
Handling Touch Event in Uilabel and Hooking It Up to an Ibaction
How to Get the Height and Width of an Uiimage
How to Implement a Swiping/Sliding Animation Between Views