Target: Taking pictures in silent mode while other GUI is running.
OS: IOS 4.3
I doing a test, I want to take one image in silent mode when ViewDidLoad is execute: I do not want any camera gui what so ever... let me know what do you think..
Observing the UIImagePickerController I see that I can assign few properties and execute takePicture method.. the bottom line is that nothing happened when try to execute it, I saw few KBs.. that tells that you have to wait.. so I did put sleep(10) but it did not help.
Maybe I missing delegate somewhere, while I read delegate is not a must.. Thoughts?
Here is the code:
Header file:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface VisionViewController : UIViewController
{
UIImagePickerController *controller;
}
-(void)settingControllerAndTakingPicture;
@end
and Implementation file
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad];
//Taking an Image
[self settingControllerAndTakingPicture ];
}
-(void)settingControllerAndTakingPicture
{
controller = [[UIImagePickerController alloc] init];
//Setting the control source type as the Camera device.
controller.sourceType = UIImagePickerControllerSourceTypeCamera;
//Camera display is off, the player will not see it during games.
controller.showsCameraControls = NO;
//Picking only the front camera.
controller.cameraDevice = UIImagePickerControllerCameraDeviceFront;
//Turning the camera flash off.
controller.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
//Setting the controller view as self view
controller.view = self.view;
//Taking a picture
[controller takePicture];
}
Again I am only interesting in silent mode.