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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:30:12+00:00 2026-05-20T10:30:12+00:00

I have a TableViewController with some items, each item when pressed pushes a ViewController

  • 0

I have a TableViewController with some items, each item when pressed pushes a ViewController with an UIWebView, the ViewController is the same in all cases, but each item asks the webView to load a diferent URL. Now the problem is that the first time I select an item, the webView doesn’t load the URL, but if I go back in my navigation controller and then press again any of the items (even the same that the first time), it loads correctly. Why could this be?

This is my code. In my TableViewController I have this inside the didSelectRowAtIndexPath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {     
 NSString *urlAddress;
 NSInteger row = [indexPath row];

 // SELECT THE URL BASED ON THE SELECTED ROW. SECTION OMMITED FOR CLARITY PURPOSES.
    urlAddress = @"http://www.google.com";

 [browserViewController refreshUrl:urlAddress];
 [urlAddress release];

 browserViewController.title = [NSString stringWithFormat:@"%@", [itemsArray objectAtIndex:row]];

 MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
 [delegate.mainNavController pushViewController:browserViewController animated:YES]; }

The browserViewController is initialized in the viewDidLoad method of the TableViewController. In the BrowserViewController implementation I have this method:

- (void) refreshUrl: (NSString *)theUrlAddress{
 NSURL *url = [NSURL URLWithString: theUrlAddress];
 NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
 [webView loadRequest:requestObj];}

But this is the method that seems to be working only from the second time is invoked. If I set a breakpoint on it, I can see it is actually being invoked the first time I press the item on the table, but the loadRequest does nothing.

BrowserViewController is also an UIWebViewDelegate. The webViewDidStartLoad and webViewDidFinishLoad methods aren’t being invoked the first time either.

Any ideas of why and how to fix it? Thanks!

  • 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-20T10:30:14+00:00Added an answer on May 20, 2026 at 10:30 am

    you are using refreshUrl on the viewController before it has created its UIWebView.
    Use a breakpoint and check the value of your webview. I think it is nil for the first time.

    Simply move [browserViewController refreshUrl:urlAddress]; to the line after the push.

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

Sidebar

Related Questions

I have splitViewController which has as MasterViewController some viewController and as DetailViewController some tableViewController.
i have a class RequestHandler that takes the requests for some ViewController and fetches
I have a navigation controller which I push a new tableviewcontroller for each received
I have some class initialized in Appdelegate, but when I get this class instance
I have looked but haven't found a reasonable answer. I have a first TableViewController
Maybe a FAQ at this website. I have a TableViewController that holds a form.
I have an iPhone app with a tableviewcontroller. When you click a certain cell
i have a DetailViewController and a Messages class(this is a TableViewController class). I parse
I have a tableview controller under a navigation controller. Some of my table cells
This has been driving me nuts all day. I have a weird bug that

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.