[MonoTouch] UIDocumentInteractionController Question/Problem only with iOS 5.0
Danny Pronk
dpronk at probe-asp.eu
Mon Oct 31 14:13:42 EDT 2011
Hello Miquel,
I did want you suggested and indeed the application is not longer crashing
on the second download under iOS 5.0
However, every time I discard the openinmenu on an iPad by clicking outside
the openinmenu the menu dissapears.
But if I then click somewhere in the web view that is on the screen, the
openinmenu reappears ! (Like the web view is executing the previous click)
If I dismiss the menu for the second time it disappears permanently !
I even also have the following code to handle the dismiss event :
void HandleDocControlDidDismissOpenInMenu (object sender, EventArgs e)
{
docController.DismissMenu(false);
docController.Dispose();;
}
So even though the application is no longer crashing, I still have unwanted
code execution/unexpected code behavior.
Please can you advise further Miguel Please ?
Kind regards
Danny
Van: Miguel de Icaza <miguel at xamarin.com>
Datum: Mon, 31 Oct 2011 08:29:42 -0400
Aan: Danny Pronk <dpronk at probe-asp.eu>
CC: "monotouch at lists.ximian.com" <monotouch at lists.ximian.com>
Onderwerp: Re: [MonoTouch] UIDocumentInteractionController Question/Problem
only with iOS 5.0
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 = new
> Dialogs.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/152c3e61/attachment.html
More information about the MonoTouch
mailing list