user1430825
user1430825

Reputation: 119

Storyboard Segue with popup button and detailview

I am creating a news app that has title, description, video and details. this is displayed on UIViewCell on TableView, when a user clicks on that particular cell, corresponding news is displayed as shown below

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

    NewsViewController *newsdetail = [[NewsViewController alloc] initWithNibName:@"NewsDetailView" bundle:nil];
    self.newsdetails = detail;
    [detail release];

    newsdetails.title = [NSString stringWithFormat:@"%@",[titleData objectAtIndex:indexPath.row]];
    newsdetails.itemID = [NSString stringWithFormat:@"%@",[NewsIds objectAtIndex:indexPath.row]];

    [self.navigationController pushViewController:newsdetails animated:YES];

}

The variables (which hold JSON data) are properly defined in NewsViewController and synthesised as follows

NSMutableArray *NewsIds;
NSMutableArray *titleData;
NSMutableArray *descriptionData; etc

enter image description here Now, what I want is to add a video button as shown on the storyboard, so that a user can click it and be able to see details of corresponding video through modal /popup any suggestions or help?

Upvotes: 1

Views: 776

Answers (2)

vignesh
vignesh

Reputation: 1064

you should have a custom table view cell which will be handling actions and data on cell.

Upvotes: 0

Juan Catalan
Juan Catalan

Reputation: 2309

In the Storyboard, just use an Action segue on the UIButton and select modal. Control Drag from the button to the Video Details VC. Give that segue a name, let's say

playVideo

Then inside the prepareForSegue method in your PlayersViewController.m you just add this:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"playVideo"]) {
    // set properties on your destinationVieController to pass the data you need
    }
}

Also use unwind segues on the buttons 'Cancel' and 'Done' in your destination VC to return to the previous TVC. Alternatively you could also use dismissViewControllerAnimated: that will be passed to the calling VC.

Upvotes: 1

Related Questions