Search code examples
iosobjective-cuitableviewuiwebview

How to redirect UIWebview?


I am new to iPhone development and I want to move to UIWebview based on the URL when the user clicks on a particular row (Google,Facebook,Yahoo). I want the page to redirect to the UIWebview.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    SBJsonParser *parser = [[SBJsonParser alloc] init];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"URL"]];
    NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
    statuses = [parser objectWithString:json_string error:nil];

    if (indexPath.row == 0) {
        //What do i write in here
    } else if(indexPath.row == 1) {

    } else if(indexPath.row == 2) {

    } else {

    }
}

Can anyone help me?


Solution

  • You have to create a new controller and navigate to that controller on click. Also you have to pass link to another controller for load the url in to webview.