I use to develop an application MonoTouch Iphone, but I have a problem using UIPopoverController. I can not open the page to select the photo.
I use the class of camera.cs TweetStation.
Here’s the code:
public static void SelectPicture (UIViewController parent, Action<NSDictionary> callback)
{
if(OzytisUtils.isIpad()){
picker = new UIImagePickerController();
UIPopoverController popover = new UIPopoverController(picker);
picker.Delegate = new CameraDelegate();
picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
popover.SetPopoverContentSize(new SizeF(parent.View.Frame.Width,parent.View.Frame.Height),true);
if(popover.PopoverVisible){
popover.Dismiss(true);
picker.Dispose();
popover.Dispose();
}else{
popover.PresentFromRect(parent.View.Frame,parent.View,UIPopoverArrowDirection.Right,true);
}
}else{
Init ();
picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
_callback = callback;
parent.PresentModalViewController (picker, true);
}
Thanks for your help.
I have a few suggestions. First make the UIPopoverController a member variable so that it does not get collected.
Second I called ContentSizeForViewInPopover on the picker.
Finally I use a 0x0 rectangle in the upper left of the screen for the PresentFromRect call.