0

I have a feed that lists news items, click on one and you get taken through to the detail view. I do this through the didSelectRowAtIndexPath method where I declare the detail view controller etc.

Is it possible to have a mixed feed whereby some of the links will be videos and others will remain links through to the detail view. So if a user clicks on the link that's a video then the video player kicks in, otherwise it's business as ususal and they go through to the other view.

The source is a JSON feed so I would need to switch the destination based on reading one of the JSON nodes and seeing if the file ending was another page or a video file.

Full Time Skeleton
  • 1,680
  • 1
  • 22
  • 39

1 Answers1

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

    if([YourOptiontype isEqual:@"video"])
    {
        // Push to Video View   
        }
    else if([YourOptiontype isEqual:@"business"])
    {
        // Push to business View    
    }

    NSIndexPath *tableSelection = [theTableView indexPathForSelectedRow];
    [theTableView deselectRowAtIndexPath:tableSelection animated:NO];
}
Arun K Sharma
  • 294
  • 1
  • 6
  • 17
  • Thanks for the reply, but the 'YourOptionType' I'm not sure where I'd get that from. If the feed has a bunch of HTML links for normal news items, but has mp4 for a video link, how would I determine which to use? – Full Time Skeleton May 17 '12 at 10:04
  • If Feed is in JSON Response then you have to parse it and find the OptionType coz i think at a time only one type comes for a cell you are selecting. And if Feed is in HTML Type then load it in Simple webview and handle all the Html from the server side. – Arun K Sharma May 17 '12 at 10:09
  • Feed will be JSON, so I imagine I'll have to find a way of looking at the last 3-4 characters of the link within the JSON and redirecting appriopriately. Do that sound right? – Full Time Skeleton May 17 '12 at 10:16
  • YES,Ask to your backend dev to provide the proper JSON for that. – Arun K Sharma May 21 '12 at 11:28