Ceci est mon code à ce jour:iPhone SDK - Comment afficher une photo prise avec l'appareil photo dans un UINavigationController?
/* class: myViewController
@interface myViewController: UIViewController
<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
*/
- (IBAction) getPicture {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
}
- (void) imagePickerController:(UIImagePickerController *)thePicker
didFinishPickingMediaWithInfo:(NSDictionary *)imageInfo
{
[[thePicker parentViewController] dismissModalViewControllerAnimated:YES];
UIImage *img = [imageInfo
objectForKey:@"UIImagePickerControllerOriginalImage"];
self.myImageView.image = img;
}
Donc, fondamentalement, je suis en train de prendre une photo de la caméra de l'iPhone et l'afficher dans un UIImageView. Cela fonctionne parfaitement bien tant que la classe myViewController est affichée en mode autonome. Si je place la vue dans un UINavigationController, l'UIImageView n'affichera pas l'image après en avoir pris une avec la caméra. Mais si je choisis une photo de la bibliothèque, tout va bien. Alors, pourquoi UIImageView n'affichera-t-il pas une image prise avec l'appareil photo dans un UINavigationController?
J'ai essayé sans succès. – dan
Avez-vous essayé ce qui suit après le réglage de l'image? [self setNeedsDisplay]; – Shingoo
Malheureusement, cela ne change rien. – dan