Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading a UIWebView from a UITableView
    primarykey
    data
    text
    <p>I've come to a part of my code where I'm a bit stumped, what I'm basically trying to do is to load once you tap for example Google in the UITableView, it will then load Google from a separate view controller that is a UIWebView. I've coded what I think is right although when I tap on Google, nothing happens. I'm not getting any errors, the app runs fine it's just as I said once you tap the selected field it doesn't lead anywhere &amp; before you say anything I did remember to import the UIWebView controller into my first view controllers .m file.</p> <p>This is my first view controller .h</p> <pre><code>@interface YoMaFifthViewController : UITableViewController { NSArray *data, *sites; } @end </code></pre> <p>This is my first view controller .m</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; data = [NSArray arrayWithObjects:@"Website", @"Developer", nil]; sites = [NSArray arrayWithObjects: @"https://www.google.co.uk/", @"https://www.google.co.uk/", nil]; </code></pre> <p>`</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } </code></pre> <p>`</p> <pre><code> // Configure the cell... cell.textLabel.text = [data objectAtIndex:indexPath.row]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; </code></pre> <p>`</p> <pre><code>#pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { YoMaWebsiteViewController *wvc = [[YoMaWebsiteViewController alloc] initWithNibName:@"YoMaWebsiteViewController" bundle:nil]; wvc.site = [sites objectAtIndex:indexPath.row]; [self.navigationController pushViewController:wvc animated:YES]; } </code></pre> <p>This is my UIWebViews .h</p> <p>`</p> <pre><code>@interface YoMaWebsiteViewController : UIViewController { IBOutlet UIWebView *webview; } @property (retain) NSString *site; @end </code></pre> <p>&amp; This is the UIWebViews .m</p> <p>`</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSURL *url = [NSURL URLWithString:self.site]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webview loadRequest:request]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload