Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6591457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:25:31+00:00 2026-05-25T17:25:31+00:00

I am observing a different behavior when presentOpenInMenuFromRect is executed in iPhone4 and iPad2

  • 0

I am observing a different behavior when “presentOpenInMenuFromRect” is executed in iPhone4 and iPad2 (both running in iOS 4.3.5). In iPad2 it is shown a drop down list, with all the applications that can open a specific file, and it works fine; however, in iPhone4 it is also shown a drop down list (and also works fine), but at the end of the drop down list there is the button “Cancel”, which seems to be inactive.

In iPad2 this problem does not happen because the button “Cancel” does not appears, only appears the drop down list, and when I tap onto another area different from the drop down list, this list is closed; which is the desired behavior.

What I mean saying that the button “Cancel”, in iPhone/iPhone4, seems to be inactive is: When I touch it, then nothing happens! Well, to be more specific, if I touch it several times in a short period or time, then, later than sooner, the button “Cancel” seems to respond (it changes its color from gray to blue) and then the drop down list is really closed; which is the desired behavior.

I am using the “presentOpenInMenuFromRect” in the following way: I have implemented a “Save” button, which by default is hidden; however, in the method “-(void)webViewDidFinishLoad:(UIWebView *)webView” I detect the “path extension” of the URL, and if it has the “.pdf” extension, then I show the “Save” button; that is:

-  (void)webViewDidFinishLoad:(UIWebView *)webView
{
    if ([[[myWebViewOL.request.URL.absoluteString pathExtension] lowercaseString] isEqualToString:@"pdf"])
    {
        saveFile0L.hidden = NO;
    }
}

And the “action” related to the “save” button (saveFile0L) is the following method “saveFile”:

[saveFile0L addTarget:self action:@selector(saveFile) forControlEvents:UIControlEventTouchUpInside];

where “saveFile” has the following code:

- (void) saveFile
{
    //Do not worry about "FileManager" is only a singleton class
    //which I have defined in order to implement some common methods
    //and one of them is "saveFile:(UIWebView*) withUIView:(UIView*)
    [[FileManager sharedInstance] saveFile:myWebView withUIView:self.view];
}

And “saveFile:(UIWebView*)myWebView withUIView:(UIView*)self.view” has the following code:

- (void) saveFile:(UIWebView*)webView withUIView:(UIView*)view
{
    NSString* fileName  = [[NSFileManager defaultManager] displayNameAtPath:webView.request.URL.absoluteString];
    NSURL* fileurl = [NSURL URLWithString:webView.request.URL.absoluteString];
    NSData* data = [NSData dataWithContentsOfURL:fileurl];
    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString* docsDirectory = [paths objectAtIndex:0];
    NSString* filePath = [docsDirectory stringByAppendingPathComponent:fileName];
    [data writeToFile:filePath atomically:YES];
    NSURL* url = [NSURL fileURLWithPath:filePath];
    //UIDocInteractionController API gets the list of devices that support the file type
    docController = [UIDocumentInteractionController interactionControllerWithURL:url];
    [docController retain];
    //Note:[docController presentOpenInMenuFromRect:CGRectZero inView:view animated:YES]
    //presents a drop down list of the apps that support the file type,
    //clicking on an item in the list will open that app while passing in the file.
    //Note: [[UIApplication sharedApplication] canOpenURL:fileurl]
    //will return YES if there is an app that can handle the specific file
    BOOL isValid = ([[UIApplication sharedApplication] canOpenURL:fileurl] &&
                    [docController presentOpenInMenuFromRect:CGRectZero inView:view animated:YES]);
    if (!isValid)
    {
        [self showAlertSaveFileError:fileName];
    }
}

At present, I do not know how to make work properly the “Cancel” button which only appears in iPhone (not in the iPad) at the end of the drop down list.

Thanks in advance,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:25:32+00:00Added an answer on May 25, 2026 at 5:25 pm
    BOOL isValid = ([[UIApplication sharedApplication] canOpenURL:fileurl] &&
                        [docController presentOpenInMenuFromRect:CGRectZero inView:view animated:YES]);
    

    Try changing view inView:view to inView:self.view.window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am observing a different output from a C++ compiled binary file, that calls
I am observing, on both Firefox and IE, that if I have a cookie
Okay, so I'm observing some behavior that I would certainly call 'unexpected' and I'm
Using OneNote 2010 doing some C# interop stuff. Observing some very strange behavior, which
I am observing a weird behavior in Firefox. I have a sub-nav menu item
Have been observing some unexpected behavior when a class region appears in another class
I'm observing an interesting behavior of make and I wonder if there is a
I am observing a weird behavior in my app: My app contains multiple textfields
I am observing a crash while calling the CMemFile::Detach() function The exception with the
We are observing 4-6 threads on Windows 7 x64 in the application which have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.