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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:29:08+00:00 2026-06-04T01:29:08+00:00

I have a very simple application that has only 2 view controllers. The initial

  • 0

I have a very simple application that has only 2 view controllers. The initial root controller has two UIButtons on it, and they both transition to the 2nd view controller via Storyboard. The information that is loaded on the 2nd view controller is determined by a buttonPressed IBAction that is linked to both the initial view controller. The problem I am having is that once I tap one of the two buttons, I get the 2nd view controller loading up blank. From debugging, I notice that the buttonPressed function is called after the 2nd view is loaded. How can I make it so that the buttonPressed function is called BEFORE the 2nd view controller is loaded blank?

Hardly any code involved, I have both UIButtons tagged 1 and 2, and the button press function loads two text files depending on the sender tag equaling 1 or 2. Everything is linked up in Storyboard. Any suggestions?

*buttonPressed function:

if([sender tag] == 1)

count = 1;

else

count = 2;

The count determines the file to be loaded.

*In Storyboard, I have just 2 view controllers, (No navigation or any of that) and two UIButtons on the initial view and a text view on the second to display text. The UIButtons are connected to buttonPressed and to the 2nd view controller segue.

  • 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-04T01:29:10+00:00Added an answer on June 4, 2026 at 1:29 am

    This sounds like a case for prepareForSegue!

    -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        if([[segue identifier] isEqualToString:@"First Button Segue Identifier"])
        {
            ViewController *theViewController = segue.destinationViewController;
            theViewController.textProperty = self.firstButtonText;
        } 
        else if ([[segue identifier] isEqualToString:@"Second Button Segue Identifier"])
        {
            ViewController *theViewController = segue.destinationViewController;
            theViewController.textProperty = self.secondButtonText;
        }
    }
    

    There you go, it is pretty generic because I didn’t know your variable names or what text you are using. Similarly, if the segues don’t have seperate identifiers, you can use the sender to determine which button is being pressed.

    Good luck!

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

Sidebar

Related Questions

I have an application that contains a main Activity, which has a very simple
I have a simple iPhone application that is very similar to the Page Control
I have a very simple web application that have to read and write in
I have a very simple application with two tables, ParentTable and ChildrenTable . Each
I have a very simple application test in which I want to drag and
I have a very simple application and I cannot make the WebView to show
I have a very simple .net application for testing SMTP on .net. But i
I have written a very simple application tha accepts batches of telemetry log rows
I have built a very simple blog application using Ruby on Rails. New to
We have a very simple ASP.NET web application comprising mostly static content and 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.