[MonoTouch] UIDocumentInteractionController Question/Problem only with iOS 5.0
Miguel de Icaza
miguel at xamarin.com
Mon Oct 31 08:29:42 EDT 2011
Hello Danny,
I noticed that you are using a local variable "docControl", and that
object might be collected once the method exists.
You do keep an InvokeOnMainThread there, but I do not believe that is
keeping a reference around. Could you try assigning that to a global
variable for now, and report if that fixes the issue?
Miguel
On Fri, Oct 28, 2011 at 7:27 AM, Danny Pronk <dpronk at probe-asp.eu> wrote:
> Hi,
>
> I am using the following code to display the OpenInMenu.
> On the iPhone when the UIDocumentInteractionController is shown, you can
> see a cancel button, and there things work like clockwork.
>
> However on the iPad (both with iOS 4.3 and iOS 5.0) you see the
> applications where you can open the file with, but NO cancel button is
> visible.
>
> When the OpenInMenu is visible and you click somewhere outside the menu it
> disappears but still remains active in memory.
> Is my problem related to the RectangleF size or am I missing something
> essential how to give the user the dismiss option on the iPad !
>
> The strange thing is that on an iPad with iOS 4.3 things seem to work ok,
> but on and iPad with iOS 5.0 the DidDissmissOpenInMenu is NEVER fired.
>
> Please help. (I have found this code on StackOverflow and until iOS 5.0
> things worked like expected!
>
>
> Below you find the code I am using.
>
> using (var pool = new NSAutoreleasePool()) {
>
> UIDocumentInteractionController docControl =
> UIDocumentInteractionController.FromUrl(nsurl);
>
> docControl.Delegate = newDialogs.UIDocumentInteractionControllerDelegateClass();
>
> docControl.DidDismissOpenInMenu += HandleDocControlDidDismissOpenInMenu;
>
> docControl.DidEndSendingToApplication +=
> HandleDocControlDidEndSendingToApplication;
>
> docControl.
>
> docControl.InvokeOnMainThread(
>
> delegate {
>
> if(_webView.IsFirstResponder)
>
> _webView.ResignFirstResponder();
>
> RectangleF theScreenSize = UIScreen.MainScreen.Bounds;
>
> float width = theScreenSize.Width;
>
> bool isValid = docControl.PresentOpenInMenu(new RectangleF(width-40,0,0,20),
> _viewController.View,false);
>
> if(!isValid)
>
> {
>
> UIAlertView avAlert = new UIAlertView(_viewController.Language.FieldValue(
> "reader_title"), _viewController.Language.FieldValue("reader_message"),
> null,_viewController.Language.FieldValue("reader_close"));
>
> avAlert.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin |
> UIViewAutoresizing.FlexibleTopMargin;
>
> avAlert.Show();
>
> }
>
> } );
>
> }
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111031/1be4dfce/attachment.html
More information about the MonoTouch
mailing list