how to disable choose button for video in UIImagePickerController - iphone

I am using UIImagePickerController to show the user which all videos he has in his Photos App.
However, I have no functionality to provide if the user clicks on Choose button, that comes up with the Cancel and play button on clicking on video thumbnail.
This is how I implement my picker:
UIImagePickerController *videoPickerCtrl = [[UIImagePickerController alloc] init];
videoPickerCtrl.delegate = self;
videoPickerCtrl.editing = NO;
videoPickerCtrl.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
NSArray *mediaTypesAllowed = [NSArray arrayWithObject:#"public.movie"];
[videoPickerCtrl setMediaTypes:mediaTypesAllowed];
[self.navigationController presentModalViewController:videoPickerCtrl animated:YES];
How can I totally remove/hide the Choose button? or can I just disable it, so that the user does not click on it?

I think, it is not possible to disable that choose button. Because that is an inbuilt
functionality of UIImagePickerController and you can not make changes in the same.

Related

Front camera is not opening every time in Pop over controller in iPad

In my iPad app i am trying to open Front facing camera in a UIPopOverController.It is behaving in strange behavior.When i first time click on button to open camera,it open front camera and second time it open rear camera again same repeat.once front camera and second time rear camera.While i have also set front camera as a camera device.Here is my code,Please help.
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
[imagePickerController setCameraCaptureMode:UIImagePickerControllerCameraCaptureModePhoto];
[imagePickerController setCameraDevice:UIImagePickerControllerCameraDeviceFront];
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
I got my answer my self. I was not releasing imagePickerController.
After releasing it i get every time front camera. ;)

UIImagePickerController fullscreen

i'm using the UIImagePickerController to show the camera view in my main view, calling it with this code:
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
and i have a self made toolbar in my storyboard, to manage some camera's functionality.
What happens is that when the app loads, the camera seems to overlay my toolbar, going in fullscreen and hiding my buttons. Why this happens?
It's normal the UIImagePickerController is ment to run full screen. You can an extra overlay view to the cameraOverlayView property to show you own controls.

use camera as subview

i'm using UIImagePickerControllerSourceTypeCamera in my app, but a want to add the camera view a subview. not as modal view.
now i'm using
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];
i want to use it like this, but doesn't seem to work ..
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
[picker.view setFrame:CGRectMake(300, 40, 300, 200)];
[self.view addSubview:picker.view];
i know that the UIImagePickerControllerSourceTypeCamera only can be used as modal view.
How is for example Hipstamatic using this for example?
This is possible in iOS 4+ using the AVCaptureSession framework. It's much more complicated than using UIImagePickerController, but you have complete control over input and output. The key to having the camera view as a subview is the following code. Assume you have a subview called previewView that you want to show the camera view:
AVCaptureSession *session = [[AVCaptureSession alloc] init];
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session];
previewLayer.frame = self.previewView.bounds;
[self.previewView.layer addSublayer:previewLayer];
There is more setup work to do to give your AVCaptureSession object the correct input and output devices and to actually capture the photos. That can be found in the documentation and examples on the web.
You're right, the only supported methods for displaying a UIImagePickerController seem to be presentModalViewController:animated: or UIPopoverController.
I'm not familiar with Hipstamatic, but chances are it is using AVFoundation, in particular AVCaptureVideoPreviewLayer.
Visit link to get idea how things can be accomplished. Look out for AVCam Demo in developer.apple.com resources for IOS programme. You will definitely get idea how it works. You should be registered developer with APPLE, and thats very easy.
Hope it helps.

Iphone Memory Warning when camera shows

i have a TabBarController in which one tab has an ImageView. Besides, i have a button to display the ImagePicker:
- (IBAction)choosePhoto {
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Delegate is self
imagePicker.delegate = self;
// Allow editing of image ?
[imagePicker setAllowsEditing:NO];
// Show image picker
[tabBarController presentModalViewController:imagePicker animated:NO];
But the problem is that when i press the button in order to launch the ImagePicker i get the message: Received memory warning. Level=1/ Level=2.
I've tried to change the delegate to the View of the tab but it doesn't works neither.
Any idea?
Thanks
A memory warning per se is not a problem. The camera needs an awful lot of memory so it is very common that the system generates a memory warning whenever the camera interface is being displayed. Just make sure to free as much memory as possible in reaction to the warning.

iPhone SDK - Changing Xib files (partial curl)

I am creating an iPhone app for iOS 4 using the newest SDK.
On one of my pages I would like the user to click a thumbnail of a photo and then a partial curl transition style take affect to show a full sized version of the image.
On the page with the full sized image I have a toolbar with a "Back" button and a "Select" button.
When I click the Back button the partial curls rolls back down to my first Xib.
BUT when I click the Select button, the app crashes.
Can anyone help me or explain why it is doing this? Thanks!
.m file:
-(IBAction)switchViews4 {
ImagePicker *image = [[ImagePicker alloc] initWithNibName:nil bundle:nil];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
[image release];
}
Without seeing any other code, it is difficult to know why. But one guess is that you have a reference counting problem. Try:
-(IBAction)switchViews4 {
ImagePicker *image = [[[ImagePicker alloc] initWithNibName:nil bundle:nil] autorelease];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
}
and see if it helps.