Search Results

Search found 15 results on 1 pages for 'imagepicker'.

Page 1/1 | 1 

  • UIImagePickerController image editing not working

    - by Greg Reichow
    I am having a problem with implementing UIImagePickerController. When the controller loads, it displays modally, and allows the user to select the image. Good so far. Yet, then when it moves to the editing phase, it often displays somewhat corrupted view (the image cropping box is halfway off the top of the screen) and their is no image. It does not crash, but all UI interaction is blocked. The strange part is that this only happens when I compile with Release settings. Under debug compile settings, the image editing works fine! I have tried checking for memory warnings during this time, but none are showing up. Here is the code calling the image picker controller for reference. When I use the camera (the first method), it always works fine. It is just when selecting images from the Library (called from the second method below) does it fail as described above. And again, only on release build, and with various different types of images. - (IBAction) showCameraController:(id)sender { self.imagePicker =[[UIImagePickerController alloc] init]; self.imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera; self.imagePicker.delegate=self; self.imagePicker.allowsEditing=YES; [self presentModalViewController:self.imagePicker animated:YES]; } - (IBAction) showPictureAlbumController:(id)sender { self.imagePicker =[[UIImagePickerController alloc] init]; self.imagePicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary; self.imagePicker.delegate=self; self.imagePicker.allowsEditing=YES; [self presentModalViewController:self.imagePicker animated:YES]; } The delegate methods are properly implemented, yet, during the problem I am describing, the controller is not yet calling those methods. It is failing when displaying the editing screen before the user is able to select cancel or save. It is just locking up with no crash. Please help!

    Read the article

  • Saving UIImagePickerController images to Core Data without crashing

    - by Gordon Fontenot
    I have been trying to minimize my memory footprint with UIImagePickerController, but I'm starting to think that the memory problems I am having are resulting from poor memory management, instead of a particular way to handle the UIImagePickerController object. My workflow is this: The "Edit Image" button is clicked, which presents a UIActionSheet. This action sheet allows you to delete, take a picture, choose from the library, or cancel. If you select Choose from the library or Take Picture, I alloc an instance of UIImagePickerController and present it, followed by a release of UIImagePickerController: -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (actionSheet.tag != 999) { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; BOOL pickImage = nil; if (actionSheet.tag == iPhoneWithDelete) { switch (buttonIndex) { case 0: object.objectImage = nil; pickImage = NO; break; case 1: imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; pickImage = YES; break; case 2: imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; pickImage = YES; break; default: pickImage = NO; break; } } else if (actionSheet.tag == iPhoneNoDelete) { switch (buttonIndex) { case 0: imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; pickImage = YES; break; case 1: imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; pickImage = YES; break; default: pickImage = NO; break; } } else if (actionSheet.tag == iPodWithDelete) { switch (buttonIndex) { case 0: object.objectImage = nil; pickImage = NO; break; case 1: imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; pickImage = YES; break; default: pickImage = NO; break; } } else if (actionSheet.tag == iPodNoDelete) { switch (buttonIndex) { case 0: imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; pickImage = YES; break; default: pickImage = NO; break; } } if (pickImage) { imagePicker.allowsEditing = YES; [self presentModalViewController:imagePicker animated:YES]; } else { [self setupImageButton]; [self setupChooseImageButton]; } [imagePicker release]; } } Once I get a selection back from the UIImagePickerController, I save 2 images, a resized version of the edited image to use for a thumbnail, and a 800x600 version of the original unedited image into a relationship attribute (Transformational, using the same UIImage to PNG transformations found in the Recipes demo code) for display use: (the resize methods are based on the one demoed in this SO post.) - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissModalViewControllerAnimated:YES]; NSManagedObject *oldImage = object.imageFull; if (oldImage != nil) { [object.managedObjectContext deleteObject:oldImage]; } NSManagedObject *image = [NSEntityDescription insertNewObjectForEntityForName:@"Image" inManagedObjectContext:object.managedObjectContext]; object.imageFull = image; UIImage *rawImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; CGSize size = CGSizeMake(800, 600); UIImage *fullImage = [UIImageManipulator scaleImage:rawImage toSize:size]; [image setValue:fullImage forKey:@"imageFull"]; UIImage *processedImage = [UIImageManipulator scaleImage:[info objectForKey:@"UIImagePickerControllerEditedImage"] toSize:CGSizeMake(75, 75)]; object.objectImage = processedImage; [self setupImageButton]; [self setupChooseImageButton]; rawImage = nil; fullImage = nil; processedImage = nil; } When I go through viewDidUnload I am setting self.object = nil, and [object release] during dealloc, but I'm still getting memory warnings after about 10 image changes, with a crash at around 20. It leads me to believe that I am not getting that full image out of memory the correct way. What am I missing here? And on a second note, does the Camera source use significantly more memory than the Photo Albums source? I tend to get more crashes when using the camera.

    Read the article

  • UIImagePickerController does nothing when using camera after I hit "Use" button

    - by wgpubs
    Code below. When I hit the "Use" button after taking a picture ... the application becomes totally unresponsive. Any ideas what I'm doing wrong? The "addPlayer:" method is called when a button is pressed on the UIViewController's view. Thanks - (IBAction) addPlayers: (id)sender{ // Show ImagePicker UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; // If camera is available use it and display custom overlay view so that user can add as many pics // as they want without having to go back to parent view if([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; } else { imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } [self presentModalViewController:imagePicker animated:YES]; [imagePicker release]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { // Grab original image UIImage *photo = [info objectForKey:UIImagePickerControllerOriginalImage]; // Resize photo first to reduce memory consumption [self.photos addObject:[photo scaleToSize:CGSizeMake(200.0f, 300.0f)]]; // Enable *PLAY* button if photos > 1 if([self.photos count] > 1) btnStartGame.enabled = YES; // Update player count label lblPlayerCount.text = [NSString stringWithFormat:@"%d", [self.photos count]]; // Dismiss picker if not using camera picker dismissModalViewControllerAnimated:YES]; }

    Read the article

  • Change UIImagePicker Navigation Bar style to blue

    - by vodkhang
    All of my view has a blue navigation bar but when I want user to choose a photo, the UIImagePicker is black. I tried to set the navigation bar of UIImagePickerController to blue using UIBarStyleDefault but it does not work for me, the color is still black. I tried with other UIBarStyle like UIBarStyleBlack and UIBarStyleOpaque as well but it doesn't change the navigation bar of the picker anyway. Here is my code // Let the user choose a new photo. UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.navigationBar.barStyle = UIBarStyleDefault; [self presentModalViewController:imagePicker animated:YES]; [imagePicker release];

    Read the article

  • How to resolve the only ImagePicker control view in landscap mode and whole application in portrait mode?

    - by Wolvorin
    I have tried almost all the answers during last two days provided by Google and SO but no luck :( What I want is my whole application is in portrait mode only. And it working fine in ios 6+. The only support required at now. But the problem is I need to launch UIImagePickerViewController with image source type camera in only landscap mode. What I tried till now is : (1) I try to create one category for UIImagePickerController for orientation. -(BOOL)shouldAutorotate { return NO; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } Like this. But the camera view is not proper aligned. It just follows the orientation of device with some +/- 90 angle but not what I required. Even the button of the camera shown by camera view as camera control is also follows the camera view, ie. the view is rotated to 90 anti clock vise and stays to that way. Is there any way to use the camera with proper alignment? or have to use other framework to work with it? Please help me. I stuck with it for last two days.

    Read the article

  • UIImagePickerController causing sqlite errors (Simulator only)

    - by MrHen
    When I display a UIImagePickerController in a UIPopoverController the console outputs the following warnings: sqlite error 8 [attempt to write a readonly database] sqlite error 8 [attempt to write a readonly database] sqlite error 8 [attempt to write a readonly database] sqlite error 1 [no such column: duration] sqlite error 1 [no such column: duration] sqlite error 8 [attempt to write a readonly database] sqlite error 8 [attempt to write a readonly database] sqlite error 8 [attempt to write a readonly database] Here is the code that displays the picker: - (void)openImagePickerController:(id)sender { //TODO only open one at a time UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; //imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.delegate = self; [self presentViewController:imagePicker sender:sender animated:YES modal:YES]; [imagePicker release]; } - (void)presentViewController:(UIViewController *)vc sender:(id)sender animated:(BOOL)animated modal:(BOOL)modal { BOOL useNavController = NO; //if((void *)UI_USER_INTERFACE_IDIOM() != NULL && if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //are we on an iPad? Class popoverClass = NSClassFromString(@"UIPopoverController"); if(!popoverClass) { useNavController = YES; } else { if(currentPopover == nil || currentPopover.contentViewController != vc) { if(currentPopover != nil) { [currentPopover dismissPopoverAnimated:animated]; [currentPopover.delegate popoverControllerDidDismissPopover:currentPopover]; } UIPopoverController *popover = [[popoverClass alloc] initWithContentViewController:vc]; currentPopover = popover; currentPopover.delegate = self; [popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:animated]; } } //[aPopover release]; } else { useNavController = YES; } if(useNavController) { if(modal) { [self presentModalViewController:vc animated:animated]; } else { [self.view addSubview:vc.view]; } } } Stepping with the debugger shows that the errors occur after [UIPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated: runs. Of note: The program continues running just fine No noticeable weirdness in UIImagePickerController's behavior when selecting an image or canceling Happens in Simulator 3.2 Unable to reproduce on iPad running 3.2 Is this just another simulator bug?

    Read the article

  • Using setSourceType with image picker up hides status bar

    - by Aaron
    I am pretty sure this is a bug but I thought I would check. I used the camera overlay to add a button so that on the iphone a user can switch from the camera view to the photo library. When button is taped the source type switches fine but the status bar is missing from the photo library. Throughout the rest of that session the status bar remains missing from all views evet thougth isStatusBarHidden reports NO. This is how the camera overlay view is created if (cameraOverlayView == nil) { [[NSBundle mainBundle] loadNibNamed:@"CameraOverlayView" owner:self options:nil]; } If camera is available this is when I set source type and add overlay if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; [imagePicker setCameraOverlayView:cameraOverlayView]; } Here is the action statement to change source type. (IBAction)selectImage; { [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; } If I don't tap the button on the overlay there is no problem with the status bar. PS. I did submit a bug report on this.

    Read the article

  • [picker dismissModalViewControllerAnimated:YES]; not working

    - by shishir.bobby
    I am using - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { } for imagepicker and using [picker dismissModalViewControllerAnimated:YES]; in iPad to dismiss the picker. also i tried using - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;{ [picker dismissModalViewControllerAnimated:YES]; } to dismiss the picker once it done the work. BUt its not dimissing it. when i tap anywhere in the screen, than only it gets dismiss. What i am doing wrong to dismiss the imagepicker? Many thnkas

    Read the article

  • How to allow tap-to-focus on the camera using an overlay

    - by AJJ
    The standard 3GS iPhone camera includes tap-to-focus (I can tap to the region I want to focus on). However when I use a custom overlay using the UIImagePickerController class, the tap to focus does not seem to work. Everything else in terms of capturing images programmatically etc is working btw. Note that my overlay view is only a small rectangle (UIView) at the bottom of the screen. It does not cover the other areas of the camera. So I believe the taps should go through (unless I am missing something). I have seen other apps use an overlay and still provide a tap-to-focus functionality, so there must be a way to do this. I use all the default controls set to be hidden as: imagePicker.showsCameraControls = NO; imagePicker.toolbarHidden = YES; imagePicker.navigationBarHidden = YES; Of course changing the above does not let me tap-to-focus (it just enables the toolbars, etc). I could not find any answers on the UIImagePickerController class reference. Any help would be greatly appreciated. Thanks!

    Read the article

  • Ipad UIImagePickerController and UIPopoverController error

    - by nishantcm
    Hi, I am using this code to open a popover with imagepicker -(IBAction)photosAction:(id)sender { // dismiss any left over popovers here UIImagePickerController* picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.delegate = self; UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker]; self.popoverController = popover; popoverController.delegate = self; [popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; [picker release]; But this results in this error request for member 'popoverController' in something not a structure or union and this error 'popoverController' undeclared (first use in this function). Also I want to dismiss the popover when the image is selected. What code should I put in the following function to dismiss the popover once the image is selected. (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { Thanks for the help!

    Read the article

  • [JS] getSelection on DIV contentEditable

    - by cactoos
    Hi all ! I am trying to achieve project and i must do a WYSIWYG editor in JavaScript. I can't use an existing editor because I need use my plugins (for example a colorPicker or imagePicker).. For this time I have this HTML : <div class="K_editor" id="idExample"> <div class="K_links"> <div class="K_editor_link K_editor_linkBold">B</div> <div class="K_editor_link K_editor_linkItalic">I</div> <div class="K_editor_link K_editor_linkUnderline">U</div> </div> <iframe width="696" height="212" frameborder="0" src="js/myEditor_iFrame.php"> <html> <head/> <body> <div id="contentIframe" contenteditable="true"> This is a test code, with <strong>bold</strong> text and <em>italic</em> text. </div> </body> </html> </iframe> <input type="submit"/> </div> On event click on ".K_editor_link", a function is open with arguments : - tagStart (exemple '', or '') - tagEnd (exemple '', or '') - id (here 'idExample') I know get a Selection on Textarea but "setSelectionRange()", ".selectionStart" and ".selectionEnd" are only for textbox (XUL), input (XHTML) or textarea (XHTML). Why can I do for do that ?? I'm realy block.. Thank all ! CactO_o's

    Read the article

  • Manually changing keyboard orientation for a view that's on top of a camera view

    - by XKR
    I'm basically trying to reproduce the core functionality of the "At Once" app. I have a camera view and another view with a text view on it. I add both views to the window. All is well so far. [window addSubview:imagePicker.view]; [window addSubview:textViewController.view]; I understand that the UIImagePickerController does not support autorotation, so I handle it manually by watching UIDeviceOrientationDidChangeNotifications and applying the necessary transforms to the textViewController.view. Now, the problem here is the keyboard. If I do nothing, it just stays in portrait mode. I can get it to rotate by adding the following code to the notification handler. [[UIApplication sharedApplication] setStatusBarOrientation:interfaceOrientation]; [textView resignFirstResponder]; [textView becomeFirstResponder]; However, the following simple test produces weird behavior. Start the app in portrait mode. Rotate the device 90 degrees clockwise. Rotate the device 90 degrees counterclockwise (back to the initial position). Rotate the device 90 degrees clockwise. After step 4, instead of the landscape-mode keyboard, the portrait-style keyboard is shown, skewed to fit in the landscape keyboard frame. Perhaps my approach is wrong from the start. I was wondering if anyone has been able to reliably make the keyboard change its orientation in response to setStatusBarOrientation.

    Read the article

  • Bug on submitted app binary but not in the simulator - CALayer position contains NaN

    - by Jonathan Thurft
    I submitted my app to the App Store where is ready to download. I've since then received some interesting crash reports when people select an image from the ImagePicker in one of my views. This bug (see below) makes the app crash. I was wondering 2 things. Can anyone spot the problem in the code below? How do you deal with bugs that are only in the App Binary but do not show up when trying to recreate them on the dev environment? - I can make the app crash with the Binary that is on the app store but when I do the same on the simulator or on my test phone the app works perfectly.. The Crash report in BugSense CALayer position contains NaN: [798 nan] Class: CALayerInvalidGeometry 0x00120e99 -[imageCroppingViewController imagePickerController:didFinishPickingMediaWithInfo:] (imageCroppingViewController.m:126) + 163481 The Code - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; imageView.image = image; CGRect rect; rect.size.width = image.size.width; rect.size.height = image.size.height; imageView.center = scrollView.center; [imageView setFrame:rect]; scrollView.contentSize = imageView.frame.size; self.navigationController.navigationBar.hidden = NO; [myPicker.view removeFromSuperview]; }

    Read the article

1