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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:42:04+00:00 2026-05-23T08:42:04+00:00

Is it worth storing references to other viewcontrollers that the current viewcontroller opens? If

  • 0

Is it worth storing references to other viewcontrollers that the current viewcontroller opens? If I have one viewcontroller displaying a screen with a button that opens a popoverviewcontroller, should I then keep a reference to it and then check afterwards to see if the variable is nil to only make the popoverviewcontroller once? Or is it unnecessary? It lead to many extra variables in some cases, and additional code, but it would be great if someone could say if this is unnecessary or not.

if (self.popoverVC == nil) {
    UIPopoverController *popVC = [[UIPopoverController alloc] initWithContentViewController:self.configureTest];
    popVC.popoverContentSize = CGSizeMake(320.0, 460.0);
    popVC.delegate = self;

    self.popoverVC = popVC;
    [popVC release];
}
  • 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-23T08:42:04+00:00Added an answer on May 23, 2026 at 8:42 am

    Storing references to other controllers is fine with me and I do it whenever it seems reasonable to me. Think of the delegate pattern as a way to model the interaction between your controllers.

    There are alternatives, though.

    In you specific case, instead of storing the reference to the controller, you could set a flag (but I don’t know if this makes sense for your specific workflow) specifying that the button was pressed.

    Not applicable in your case but possibly useful in general is accessing the “parent” hierarchy of UIViewControllers. This is not explicitly maintained by UIKit, so either you set the parentViewController property or you can go from one controller to its parent navigating the UIResponder hierarchy. This is not applicable to your case, it seems to me, because communication would be initiated by the child controller (in your case you are interested in the opposite). Anyway, google for it, if you are interested.

    Another option you have is using notifications: one controller can register for notifications, another can observe it.

      [[NSNotificationCenter defaultCenter] postNotificationName:@"notifName" object:self];
    
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reactToNotif:) name:@"notifName" object:nil];
    

    This is a bit more expensive than a function call, but it requires no ivar and no coupling between controllers.

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

Sidebar

Related Questions

If I have an app that connects to Amazon's S3 service, is it worth
ok. simple one that is wrapping my brain I have a method that I
We are using NHibernate, and one of the common patterns we have for storing
I have a stored procedure that returns a valueI call it from other stored
Is it worth it to develop WAP webpage for cellular since now cellular have
So I have this code that takes care of command acknowledgment from remote computers,
I currently have an asp.net website hosted on two web servers that sit behind
I created a simple WCF web service that has one method: SubmitTicket(flightticket ft, string
I want to display about one or two full screens worth of text in
Is it worth learning the convention or is it a bane to readability and

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.