Adding a UIImage from the UIImagePickerController to a UIButton?

Hooray... I answered my own question! I discovered that the reason it wasn't working properly was because I was using didFinishPickingImage:editingInfo: which is DEPRECATED. I should've been using imagePickerController:didFinishPickingMediaWithInfo: instead.

Now it's working perfectly, yay! For some reason XCode wasn't warning me of the deprecation. Got there in the end!

I'm still having the same issue and am using the new delegate method. Still can't figure out why the camera image isn't loading in the button. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = info objectForKey:UIImagePickerControllerOriginalImage; _header.

SelectPhotoButton setImage:image forState:UIControlStateNormal; self. NavigationController dismissModalViewControllerAnimated:YES; } _header. SelectPhotoButton is my UIButton.

Everything works fine when selecting a photo from the camera roll but not at all when the image is taken with the camera.

You are using the Original Image rather than the edited one. You may have problems with memory because the original image will be in the magnitude of megapixels. Have you tried using UIImagePickerControllerEditedImage instead?

– jowie Sep 29 '10 at 13:27 Also I think you need to put UIImagePicker... inside an NSString wrapper... info objectForKey:@"UIImagePickerControllerOriginalImage" – jowie Sep 29 '10 at 13:28 In this case I wasn't allowing editing so the original image was the one I needed to use. UIImagePickerControllerOriginalImage is a string constant in UIKit so you can just pass it in directly as the key. – Colin Sep 29 '10 at 15:57 In the end it turned out to be a weird device issue.

Everything worked fine on a couple of our test devices. Once I restarted my device everything worked fine. No clue why.

But it works! – Colin Sep 29 '10 at 15:58 Bingo :) glad it now works. – jowie Sep 29 '10 at 16:46.

I have a UIButton which the user clicks on to bring up a UIImagePickerController. Once this has processed it returns an edited UIImage to a delegate handler, which then is supposed to populate the UIButton with the new image. In practise, however, what happens is if the user selects an image from their library, it works fine.

But if they take a picture using the camera and edit it, the image doesn't make it to the UIButton. However... If I put the same image into a UIImageView for test purposes, it shows up. Moreover, this works fine in the Simulator, but doesn't work on the device.

Is it some kind of memory issue?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions