How to link individual cell in uitableview to distinct URL?

admin

Administrator
Staff member
I currently have two separate arrays of titles in my uitablview. Each array is grouped in it's own section. Eg. Section 1 (item1, item2, item3) Section 2(item1, item2, etc). I would like to link each cell to a certain wordpress post. How would I do this? I have linked below all of my code below the viewdidload method which contains the arrays.

Code:
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return numberOfSections;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    switch (section) {
        case manualSection:
            return [self.manual count];
        case interviewSection:
            return [self.interviews count];
        default:
            return 0;
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath         *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier     forIndexPath:indexPath];

    switch (indexPath.section)
    {
        case manualSection:
            cell.textLabel.text = [self.manual objectAtIndex:indexPath.row];
            break;
        case interviewSection:
            cell.textLabel.text = [self.interviews objectAtIndex:indexPath.row];
            break;
        default:
            cell.textLabel.text = @"Not Found";
    }
    return cell;

}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

    switch (section) {
        case manualSection:
            return @"Manual";
            break;
        case interviewSection:
            return @"Interviews";
            break;
        default:
            return 0;
    }

}