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 6994517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:54:10+00:00 2026-05-27T19:54:10+00:00

I am using a UIWebView and don’t want the navigation bar to appear unless

  • 0

I am using a UIWebView and don’t want the navigation bar to appear unless the user taps anywhere on the screen that isn’t a link.
So I have this code to display the navigation bar after a delay:

- (void)handleTapGesture:(UITapGestureRecognizer *)sender  
{      
.... 
[self performSelector:@selector(showNavigationBar) withObject:self afterDelay:0.2]; 
}

I’m not calling showNavigationBar immediately when the tap handler is invoked because the user might have tapped on a link in which case the tap hander is called before UIWebView shouldStartLoadWithRequest, so if I hid the navigation bar in shouldStartLoadWithRequest it would flash momentarily onto the screen.
So instead I set it to display after a delay which gives time for the following code to execute within shouldStartLoadWithRequest (and if the user didn’t tap on a link shouldStartLoadWithRequest isn’t called and the navigation bar is displayed, as it should be in that case).

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType  
{ 
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(showNavigationBar) object:nil];
...

However this isn’t working, I’ve increased the delay time to several seconds and can confirm cancelPreviousPerformRequestWithTarget is getting called before the navigation bar has been displayed, but when the specified time elapses the bar displays. cancelPreviousPerformRequestWithTarget is having no effect.

Does anybody know why its not working?

  • 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-27T19:54:10+00:00Added an answer on May 27, 2026 at 7:54 pm

    In the documentation of that + (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(id)anArgument method there is this sentence :

    This method removes perform requests only in the current run loop, not all run loops.

    If I’m interpreting it correctly it would mean that you need to cancel your action in the same run loop that you launched it. Which is clearly not what you want to do.

    A way to go around this would be to have a flag that showNavigationBar would have to check to see if it should proceed or abort.

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

Sidebar

Related Questions

I want to restrict the users from using the links in a UIWebView. Hence,
I load a UIWebView from a string in a navigation based app. I'm using
I am using UIWebView to load a URL. Inside the page of that URL,
Can we build an Application using UIWebView that will entirely mimic the Safari Browser?
I'm using html/javascript with iOS and UIWebView. I want to invoke an objective-c method
I want to execute javascript code from my iPhone application using UIWebView. But only
I'm using a UIWebView like that in the viewDidLoad: webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,
I want to load a word document using UIWebView. I used the code provided
I set the content of a UIWebView using loadHtmlString: . I don't add them
Does anybody know a possibility to center simple pictures within a UIWebview without using

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.