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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:57:38+00:00 2026-05-22T17:57:38+00:00

I have a viewController, lets say blaVC , which calls another view controller blubbVC

  • 0

I have a viewController, lets say blaVC, which calls another view controller blubbVC through a button press. As there are 4 buttons, all calling blubbVC with the same nib, but the content should vary according to which button was pressed in blaVC (content will be loaded from a plist), I’d need blubbVC to know “I’ve been called, because button A was pressed, so I’ll load from the plist with objectForKey:@”button A”” (so to speak..).

I call blubbVC like that

- (IBAction) buttonA:(id)sender {
blubbVC *detailView = [[blubbVC alloc] initWithNibName:@"blubbNib" bundle:nil];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
}

I tried to pass sender, but as I load the content in initWithNibName, sender comes to late, the content was already loaded (or tried to) and my view stays empty. How would I do that?

Thank you!

  • 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-22T17:57:39+00:00Added an answer on May 22, 2026 at 5:57 pm

    You should define a function that says takes the sender (or some value representing which button was pressed) that sets up all the state, after it’s been initialized.

    For example:

    [detailView setupContent:(id)sender];
    

    When you init the view controller, it’s not yet displayed. Before you call pushViewController, call the new function, so you’d have:

    - (IBAction) buttonA:(id)sender {
        blubbVC *detailView = [[blubbVC alloc] initWithNibName:@"blubbNib" bundle:nil];
        [detailView setupContent:sender];
        [self.navigationController pushViewController:detailView animated:YES];
        [detailView release];
    }
    

    If it’s true that this is too late (you need the data in ‘initWithNibName’), then either define your own -[initWithNibName: andSender:] or something similar, and calls [super initWithNibName:] before setting up the rest of the state.

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

Sidebar

Related Questions

Lets say I have a view, myView, a view controller, myViewController, and some sort
Let's say I have a ViewController that needs access to a view. In the
Let's say I have an abstract class called ViewController, and another abstract class called
Let's say you have a tab view controller on the navigation controller view stack.
I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
A simple question: I have a Model-View-Controller setup, with Models accessing a SQL database.
I have a viewController that pops a modal view with a UIWebView. If I
Very basic question about iPhone memory management: Say I have a viewController with several
Lets say we have the following entities. Entity A Entity B Entity C The
I have a simple view controller with a few buttons that are defined as

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.