Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7401317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:26:02+00:00 2026-05-29T04:26:02+00:00

I have a table based off Sam’s Teach Yourself iOS Development’s FlowerViewController , that,

  • 0

I have a table based off Sam’s Teach Yourself iOS Development’s FlowerViewController, that, under didSelectRowAtIndesPath it goes to a website in a new nib (I tweaked part of the passing data).
MY QUESTION: I would like to update this to, instead of going to a nib, to segue within a storyboard. I know that instead of using didSelectRow… I use prepareForSegue…but I can’t figure out the details…

my I have ViewController.m with the following:

- (void)viewDidLoad {
    [self movieData];
    [super viewDidLoad];

    self.title = @"Movies";

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}


#pragma mark -
#pragma mark Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [movieSections count];
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [[movieData objectAtIndex:section] count];
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] 
                 initWithStyle:UITableViewCellStyleSubtitle 
                 reuseIdentifier:CellIdentifier];
    }

    // Configure the cell.

    [[cell textLabel] 
     setText:[[[movieData 
                objectAtIndex:indexPath.section] 
               objectAtIndex: indexPath.row] 
              objectForKey:@"name"]];

    [[cell imageView] 
     setImage:[UIImage imageNamed:[[[movieData 
                                     objectAtIndex:indexPath.section] 
                                    objectAtIndex: indexPath.row] 
                                   objectForKey:@"picture"]]];

    [[cell detailTextLabel] 
     setText:[[[movieData 
                objectAtIndex:indexPath.section] 
               objectAtIndex: indexPath.row] 
              objectForKey:@"detail"]];
    cell.detailTextLabel.numberOfLines = 0;

    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}


// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    WebViewController *webViewController = 
    [[WebViewController alloc] initWithNibName:
     @"WebViewController" bundle:nil];

    webViewController.detailURL=
    [[NSURL alloc] initWithString: 
     [[[movieData objectAtIndex:indexPath.section] objectAtIndex: 
       indexPath.row] objectForKey:@"url"]];

    webViewController.title=
    [[[movieData objectAtIndex:indexPath.section] objectAtIndex: 
      indexPath.row] objectForKey:@"name"];

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

}


#pragma mark -
#pragma mark Table view delegate



#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}


- (void)movieData {

    NSMutableArray *myMovies;

    movieSections=[[NSMutableArray alloc] initWithObjects:
                    @"Movies",nil];

    myMovies=[[NSMutableArray alloc] init];

    [myMovies addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Movie1",@"name",
                           @"1.png",@"picture",
                           @"http://www.url1.com",@"url",@"Some information",@"detail",nil]];
    [myMovies addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Movie2",@"name",
                           @"2.png",@"picture",
                           @"http://www.url2.com",@"url",@"Some information 2",@"detail",nil]];
    [myMovies addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Movie3",@"name",
                           @"3.png",@"picture",
                           @"http://www.url3.com",@"url",@"Some information 3",@"detail",nil]];
    [myMovies addObject:[[NSMutableDictionary alloc]
                           initWithObjectsAndKeys:@"Movie4",@"name",
                           @"4.png",@"picture",
                           @"http://www.url4.com",@"url",@"Some information 4",@"detail",nil]];

    movieData=[[NSMutableArray alloc] initWithObjects:
                myMovies,nil];
}

I attempted to comment out the didSelectRowAtIndexPath and add the following for the segue, but the cell highlights and nothing happens (thankfully it doesn’t freeze/crash, but there’s nothing positive)

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([[segue identifier] isEqualToString:@"movieSegue"]) {

        NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
        WebViewSegue *_webViewSegue = [segue destinationViewController];
        _webViewSegue.detailURL =
        [[NSURL alloc] initWithString:[[[movieData objectAtIndex:selectedRowIndex.section] objectAtIndex:
                                         selectedRowIndex.row] objectForKey:@"url"]];
    }
}

Then I want it to pass to WebViewSegue

WebViewSegue.h:

@interface WebViewSegue : UIViewController  {
    IBOutlet UIWebView *detailWebView;
    NSURL   *detailURL;
    IBOutlet UIActivityIndicatorView *activity;
    NSTimer *timer;
}

@property (nonatomic, weak) NSURL *detailURL;
@property (nonatomic, weak) UIWebView *detailWebView;
@property (nonatomic, weak) UIActivityIndicatorView *activity;

@end

WebViewSegue.m:

@synthesize detailWebView =_detailWebView;
@synthesize detailURL = _detailURL;
@synthesize activity =_activity;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


- (void)viewDidLoad {
    [super viewDidLoad];

    [detailWebView loadRequest:[NSURLRequest requestWithURL:detailURL]];

    timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) 
                                             target:self 
                                           selector:@selector(tick) 
                                           userInfo:nil 
                                            repeats:YES];
}

-(void)tick {
    if (!detailWebView.loading) 
        [activity stopAnimating];
    else 
        [activity startAnimating];

}


- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(void)wevView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Cannot connect"
                                                    message:@"Please check your connection and try again" 
                                                   delegate:nil 
                                          cancelButtonTitle:@"OK" 
                                          otherButtonTitles:nil];
    [alert show];
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:26:03+00:00Added an answer on May 29, 2026 at 4:26 am

    I’ve answered your question in another post on the site. See my answer here.

    Specifically on how to pass data from a table to the next storyboard segue, first create a property for the data in the next storyboard segue (i.e. the destination view controller). Then set that property in the prepareForSegue method of the table (the source view controller).

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        // needed if you have multiple segues
        if ([[segue identifier] isEqualToString:@"changeNameAndDate"])
        {
            [[segue destinationViewController] setDataProperty:self.tableData];
            // where dataProperty is the property in the designation view controller
            // and tableData is the data your are passing from the source
        {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a heap based table in MySQL that I am trying to update
I have a DataGridViewComboBoxColumn in a DataGridView that's based on a lookup table. The
I have a simple MySQL query that selects all columns from the table based
I have written a script which dynamically creates a html table based off server
I'd like to have a div on my web page that is based off
I have a table in a DB (Postgres based), which acts like a superclass
I love NHibernate's ability to have one table to store multiple types based on
I have a Tabular type Form based upon a SELECT * FROM table type
I have a LINQ to SQL class VoucherRecord based on a simple table. One
I am trying to insert an image into a table cell based off a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.