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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:14:58+00:00 2026-06-12T17:14:58+00:00

The functionality I want is this: I have a set of URLs that I

  • 0

The functionality I want is this:

I have a set of URLs that I want to load into an existing UIWebView without pushing in a new ViewController. I just want the webView to reload with no animation or sliding.

Right now, this is my implementation in ViewController:

@synthesize webView;

@synthesize requestObj;

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization

    //I show a spinner while it is loading. This is done in webViewDidStartLoad:
    viewLoading = YES;

    //this is landing URL, so I draw some buttons in viewDidLoad
    home = YES;  

    //I load this request into my webView in viewDidLoad
    requestObj = [NSURLRequest requestWithURL:[NSURL URLWithString:myURL]];
    }
    return self;
}

Then, somewhere down in the ViewController, if someone presses a specific URL in my sliding menu I call:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:newUrl]];
[webView loadRequest:request];

I cannot figure out how to load this new URL into the exciting webView without a new version of ViewController being pushed into the stack. Every time it calls my initWithNibName: method in ViewController, but I can’t figure out a good way to stop it from pushing itself on to the stack, and just update the webView.

I can use [self.navigationController setViewControllers:] to make a new ViewController and keep the controller from drawing the backButton, but it still sliding.

There must be an easy way to reload the webView that I am just not getting. Any suggestions?

  • 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-06-12T17:14:59+00:00Added an answer on June 12, 2026 at 5:14 pm

    Ok, I figured out why this behavior was going on:

    I am capturing some URLs from the webView and I am pushing a new ViewController in the method:

    BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
    

    I was not checking properly for the URLs I only wanted reloaded, as opposed to pushed. So everytime the method above was called it pushed a new ViewController with the URL.

    I went in and got a substring of the URL I did not want being pushed into another view:

    - (BOOL)homeURL:(NSString *)url
    {
        BOOL match = NO;
        url = [self urlType:url];
    
        if ((url) && ((NSOrderedSame == [url compare:subtring])))
        {
            match = YES;
        }
    
        return match;
    }
    
    - (NSString *)urlType:(NSString *)url
    {
        NSRange beginSubstring = [url rangeOfString:@"com/"];
        NSString *val = url;
    
        if (url)
        {
            val = [val substringWithRange:NSMakeRange((beginSubstring.location + 4), substring.length)];
        }
    
        return val;
    }
    

    Then I fixed the method above to catch the substring:

    //capture URL
    - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
    {
    
        if (!viewLoading)
        {
            if ([self homeURL:request.URL.absoluteString])
            {
                return YES;
            }
            else
            {
                ViewController *newPage = [[ViewController alloc] initWithNibName:@"ViewController" request:request home:NO bundle:nil];
                [self.navigationController pushViewController:newPage animated:YES];
                return NO;
            }
        }
    
    
        return YES;
    }
    

    Seems to work well now!

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

Sidebar

Related Questions

I want to achieve the functionality that this editor has got with its preview
I want to add a dashboard functionality to an existing java web application, this
I have this jsfiddle set up with a script that takes the value of
I have this web application that has grown to an unmanageable mess. I want
I have a set of PHP scripts that are directly executed-- now I want
I have a set of tabs and want to add mouseover functionality to them.
We alert user using this javascript, now i want to add this functionality to
I want to expand on the functionality related to this question . Is there
i want the following functionality. input : this is test <b> bold text </b>
I want to draw a custom TabControl with custom functionality. To do this, i

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.