In the following code, webTableViewCell
is a subclass of UITableViewCell (which I've created to avoid this) in which I've binded an IBOutlet of webview from a prototype cell of a tableView in my viewController
to this webTableViewCell
class.
The URLs are loading whereas the webViews in the tableViewCell aren't. I think the problem is within the tableView:cellForRowAtIndexPath:
method. Can someone help me out?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
webTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"My Cell"];
if(!cell)
cell = [[webTableViewCell alloc]initWithFrame:CGRectZero];
NSString *urlString = [NSString stringWithFormat:@"http://www.facebook.com/%@",[myArrayOfLinks objectAtIndex:indexPath.row]];
NSURL *url = [NSURL URLWithString:urlString];
NSLog(@"%@", url);
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[cell.webView loadRequest:urlRequest];
return cell;
}