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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:47:21+00:00 2026-06-13T04:47:21+00:00

I have a UIWebView class that is added to each storyboard on load, but

  • 0

I have a UIWebView class that is added to each storyboard on load, but when passing into this class the page I require form the parent ViewController it only show the file from the first ever page and on each different page/viewController its the same even though I set it different on each.

Is it somehow caching this page and if so, how can I have a clean UIWebview everytime?

my UIwebview class m file (ContentView.m):

  - (id)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
         NSString *urlpath = [[NSBundle mainBundle] pathForResource:pageToDisplay ofType:@"html" inDirectory:@"pageContent"];
          NSURL *url=[[NSURL alloc] initFileURLWithPath:urlpath];
          NSURLRequest *request=[NSURLRequest requestWithURL:url];

          [self loadRequest:request];
       }
      return self;
  }

My Parent view passes the requested page using the following variable pageToDisplay:

Parent View m file:

  #import "ContentView.h"

    - (void)viewDidLoad {
        ContentView *dispalyPageContent = [[ContentView alloc] init];
         [dispalyPageContent setPageToDisplay:@"THEpg1"];
         [self.view addSubview:dispalyPageContent];
          //-- 
         [super viewDidLoad];
    }

For each other parent view the code is the same but the [displayPageContent setPageToDisplay:@"THEpg1"]; which should change the page I want, e.g. next view would be [displayPageContent setPageToDisplay:@”THEpg2″];

Is it possible to clear this and load a fresh request each time?

  • 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-13T04:47:22+00:00Added an answer on June 13, 2026 at 4:47 am

    It’s because when you call ContentView *dispalyPageContent = [[ContentView alloc] init]; in your viewDidLoad , you init it with:

    NSString *urlpath = [[NSBundle mainBundle] pathForResource:pageToDisplay ofType:@"html" inDirectory:@"pageContent"];
    

    And in pathForResource:pageToDisplay at the moment of initializing is some trash.

    And then, when you call [dispalyPageContent setPageToDisplay:@"smth"] , it changes nothing, because your class ContentView has been already inited with some trash in PageToDisplay

    (Also, you call [[ContentView alloc] init]; and in your code there is only initWithFrame:... for objects of ContentView class)

    You can solve this in this way:
    1) in your ContentView.m

     - (id)initWithFrame:(CGRect)frame pageToDisp:(NSString *)pageToDisp {
         self = [super initWithFrame:frame];
         if (self) {
             NSString *urlpath = [[NSBundle mainBundle] pathForResource:pageToDisp ofType:@"html" inDirectory:@"pageContent"];
              NSURL *url=[[NSURL alloc] initFileURLWithPath:urlpath];
              NSURLRequest *request=[NSURLRequest requestWithURL:url];
    
              [self loadRequest:request];
           }
          return self;
      }
    

    2) In your ContentView.h:

    - (id)initWithFrame:(CGRect)frame pageToDisp:(NSString *)pageToDisp
    

    3) And then, in viewDidLoad:

    - (void)viewDidLoad {
            ContentView *dispalyPageContent = [[ContentView alloc] initWithFrame:someFrame pageToDisp:@"THEpg1"];
    
             [self.view addSubview:dispalyPageContent];
              //-- 
             [super viewDidLoad];
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIWebView that I'd like to load a web page and also
I have a UIWebView in my iPhone app that have a web page with
I have a UIWebView that loads a link, http://www.google.com/a/datacommsales.net . But I want to
I have a uiwebview that sends its loaded page url to a uitableview to
I'm loading in a UIWebView from another class, and that works great. But now
I have an app that I load in a uiwebview, it first load a
I have an UIWebView that loads a HTML form. When I select a text
I have built a class that intercepts UIWebView resource loading by subclassing NSURLCache and
I have an html string that I've received from UIWebView from this call: NSString
I have a UIWebView named wView. I want to use webViewDidFinishLoad: in my class,

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.