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

  • SEARCH
  • Home
  • 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 6137911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:47:08+00:00 2026-05-23T17:47:08+00:00

    I am having an issue dismissing a modal view controller on a certain edge

  • 0

    I am having an issue dismissing a modal view controller on a certain edge case. I display the modal view when I am retrieving a PDF to display in a UIWebView. When the file I am retrieving is very small the modal view will try to dismiss too soon. I present the modal view in the view controller that contains the UIWebView. I dismiss it in the UIWebView’s didFinishLoad delegate method.

    I am fine with not animating the initial presentation of the modal view… but is that any more safe than what I was doing? does this still have potential to fail, and if so how would you change it? I have been looking through the docs and nothing I have read so far adresses this situation.

//
// This will download the file if not @ specific path, otherwise use local file.
// _myFileManager is a helper class and _myFileRecord is the backing data model
//
-(id)initWithNib... fileRecord:(MYFileRecord *)_myFileRecord
{
    [_myFileManager cacheFileAsync:_myFileRecord delegate:self];
}

- (void)viewDidLoad 
{
    // doesn't seem to work, NO for animated does seem to work
    [self.navigationController presentModalViewController:_splashController 
                                                 animated:YES];        
    _splashController.messageLabel.text = @"Retrieving File...";
}

- (void)recordSaved:(MyFileRecord *)myFileRecord fileName:(NSString *)fileName
{
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:fileName]];
    [_webView loadRequest:request];
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    _splashController.messageLabel.text = @"Opening File...";
}

//
// This fails when a small file is already cached to disk and the time
// for the webView to finishLoad is faster than the splashView can present itself
//
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [self.navigationController dismissModalViewControllerAnimated:YES];
}
  • 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-23T17:47:08+00:00Added an answer on May 23, 2026 at 5:47 pm

    Try implementing the viewDidAppear in your SplashController, to catch when the view has finished animating, and set a flag. Then you can control if the SplashController’s view has finished loading using this flag, and wait for it if it is not finished yet?

    E.g.

    -(void)viewDidAppear {
      if (shouldDismiss) {
        [self dismissViewControllerAnimated:YES];
      }
      readyToDismiss = YES;
    }
    

    And in your main VC:

    -(void)webViewDidFinishLoading:(UIWebView*)webViewv
    {
      if (_splashController.readyToDismiss) {
        [_splashController dismissViewControllerAnimated:YES];
      } else {
        _splashController.shouldDismiss = YES; // will dismiss in viewDidAppear
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble uploading a file size over 4 MB. I've tried adding <httpRuntime
I'm having an issue with an event handler in SharePoint. I have a list
I'm having an issue with a Struts 1 form, which contains a logic:iterate in
thanks for looking. I'm having an issue i cant seem to get the submit
Having a nightmare trying to figure out event Bubbling.. Full test case : <html>
I'm having some trouble getting a SplitLayoutPanel to display using UiBinder. It seems like
I'm having a peculiar issue. I'm reading the HTML from a div contenteditable, and
I am attemtping to solve an issue I am having and decided to try
I'm having an issue with my grails application. I have a form whose method
I'm having a weird (and probably obvious) problem with a modal window in IE6,

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.