iOS Cell Label link

Posted by hart1994 on Stack Overflow See other posts from Stack Overflow or by hart1994
Published on 2012-06-08T10:30:05Z Indexed on 2012/06/08 10:40 UTC
Read the original article Hit count: 224

Filed under:
|

Hi I am new to iOS programming and I need a little help.

I have a table view cell which is populated by data from a .plist file. I need to be able to make a link within one of the cells. How could I do this?

Here is the code which is loading the data into the cells:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"CustomTableCell";
    static NSString *CellNib = @"DetailViewCell";



    DetailViewCell *cell = (DetailViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil];
        cell = (DetailViewCell *)[nib objectAtIndex:0];
    }   

    cell.accessoryType = UITableViewCellAccessoryNone;
    cell.cellTitleLabel.textColor = [UIColor blackColor];
    cell.cellTitleLabel.font = [UIFont systemFontOfSize:20.0];
    cell.cellSubtitleLabel.textColor = [UIColor darkGrayColor];

    informations = [[NSArray alloc] initWithObjects:@"City", @"Country", @"State", @"History", @"Link", nil];
    subtitles = [[NSArray alloc] initWithObjects:titleString, subtitleString, stateString, populationString, @"Link", nil];


    cell.cellTitleLabel.text = [informations objectAtIndex:indexPath.row];
    cell.cellSubtitleLabel.text = [subtitles objectAtIndex:indexPath.row];

    return (DetailViewCell *) cell; 
}

For the cell "Link" I need it to open a url which is stored in the .plist file. How could i do this?

Many thanks

Ryan

PS: I'm a newbie at this stuff, so be descriptive. Thanks

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios