2010-07-29 11 views
9

J'ai le code suivant:UIImagePickerController problèmes iPad

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] initWithRootViewController:self]; 
imagePicker.delegate = self; 

popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; 
[imagePicker release]; 
[popover presentPopoverFromRect:CGRectMake(100, 100.0, 0.0, 0.0) 
         inView:self.view 
     permittedArrowDirections:UIPopoverArrowDirectionAny 
         animated:YES]; 

Mais ce ne détruit que la self.view et ne montre rien du tout. Quand je mets le inView: à [self.view window] le sélecteur au moins apparaît. Mais il supprime toujours le self.view. Que dois-je faire pour que la vue ne disparaisse pas?

Répondre

14

Vous initialisez le UIImagePickerController incorrect. Essayez de changer à

[[UIImagePickerController alloc] init] 
+0

Thx, je devais avoir été aveugle! – V1ru8

2

Vous essayez d'insérer une popup dans la vue correspondante! InitWithRootViewController est la vue (contrôleur) à afficher à l'intérieur de la fenêtre contextuelle

Inview est la vue où le popup apparaîtra