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

  • SEARCH
  • Home
  • 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 7510433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:13:24+00:00 2026-05-29T23:13:24+00:00

So, using storyboard you can create a segue from the UITableViewCell from the first

  • 0

So, using storyboard you can create a segue from the UITableViewCell from the first tableViewController to a detailViewController.

Not too complicated, however, when a UISearchBarDisplayController is introduced into the storyboard mix, how can you segue the results cell to the detailViewController?

I am able to search without a problem, I followed this tutorial: http://clingingtoideas.blogspot.com/2010/02/uitableview-how-to-part-2-search.html

All I can do is select a row from the search, it turns blue and doesn’t go to the detailViewController.

I have implemented the method prepareForSegue, which works for the non searched cells, but can’t figure out this one.

  • 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-29T23:13:25+00:00Added an answer on May 29, 2026 at 11:13 pm

    Ok I think I got it, it seems like a bit of a hack but it works for my purposes:

    I am using storyboard:
    I have a UITableview controller with UISearchBarDisplayController directly on top of it. No code just drag and drop.

    From there, I followed this tutorial to get the search bar to search correctly http://clingingtoideas.blogspot.com/2010/02/uitableview-how-to-part-2-search.html

    However prepareForSegue: would only let me display a cell from the original array, not with the search array.

    So I used didSelectRowAtIndexPath:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (savedSearchTerm) {
        searchRowSelected = indexPath.row;  //<-- the trick that worked
        [self performSegueWithIdentifier:@"ShowDetail" sender:self];
    }
    }
    

    searchRowSelected is an int variable that I declared at the top of the class.

    didSelectRowAtIndexPath: knew which row I was selecting, but prepareForSegue didn’t. Thats why I needed that variable.

    This is how I used it in prepareForSegue:

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if ([segue.identifier isEqualToString:@"ShowDetail"]) {
    
        dvc = [segue destinationViewController];
    
        NSIndexPath* path = [self.tableView indexPathForSelectedRow];
        int row = [path row];
    
        if (savedSearchTerm){   //set the detailViewController with the searched data cell 
            myDataClass* c = [searchResults objectAtIndex:searchRowSelected];
            dvc.myDataClass = c;
        }else{    //set the detailViewController with the original data cell
           myDataClass* c = [array objectAtIndex:row];
           dvc.myDataClass = c;
       }
    }
    }
    

    Also use this code to clean up savedSearchTerm

    -(void) searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller{
        [self setSavedSearchTerm:nil];
    }
    

    If anyone has a better solution I’m all ears 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iPhone/iPad dev newb here... I am using MonoTouch to create a universal iPad/iPhone storyboard
I'm using storyboard to create a grouped UITableView . Within the table I have
If an app is developed using Storyboard in Xcode 4.2, can this app run
Hi there, Now I'm trying to create a Pop-OverView using an Xcode storyboard. Firstly,
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using Xcode 4.2 Storyboard, I've just created a segmented control in a view with
I've created a subclass of UITableViewCell . Until now, I've only been using cells
I am designing an iOS app using XCode 4.2's storyboard feature. The app has

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.