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 8444897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:31:04+00:00 2026-06-10T09:31:04+00:00

I have a UIViewController in a storyboard iPhone app that I need to reuse

  • 0

I have a UIViewController in a storyboard iPhone app that I need to reuse in several places. In the storyboard, there is a UIBarButtonItem that has a triggered segue to another controller. In some cases, however, I would like to override the behavior of the button to segue to a different view controller. I’m thinking that there must be a way to either initialize the view controller with a message that specifies the target view controller, or to set some property after the controller is initialized but before it’s pushed?

One challenge seems to be that segues can’t be defined programmatically (based on what I’ve read so far), and I don’t think I can have multiple segues on the same view controller in storyboard. So I may need to do something like this:

[self presentModalViewController:myNewVC animated:YES];

… rather than use a segue, but I’m not sure how to override the behavior of the button defined in storyboard to do it that way.

Any help is appreciated.

  • 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-06-10T09:31:05+00:00Added an answer on June 10, 2026 at 9:31 am

    Just create an IBAction and a BOOL for some condition to pick which view controller should be instantiated.

     UIViewController *viewController;
        if (someCondition) {
            viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"someViewID"];
        }else{
            viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"someOtherID"];
        }
        [self presentViewController:viewController animated:YES completion:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an universal App with two storyboards: iPhone.storyboard iPad.storyboard Now I have views
In my App I have a ParentViewController that have several elements in it. One
I have a UIViewController in storyboard that includes a scrollView. I want to put
I have a storyboard with 1 UIViewController , holding 1 UIView that contains a
Here's what I have : A Storyboard with A UIViewController that contains a UITableView
I have a storyboard with 2 scenes. Each scene has a segue ctrl+dragged from
I have this code (Book1 is a UIViewController Class) Book1 *book = [self.storyboard instantiateViewControllerWithIdentifier:@Book1ID];
I have a problem with data in UITableView. I have UIViewController, that contains UITableView
I have a uiviewcontroller with two properties: trackName and playerObject. PlayerObject also has a
My current storyboard layout UIViewController | +- UIView (MyView) in MyView I have the

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.