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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:12:02+00:00 2026-05-16T18:12:02+00:00

I have two views, the parent view opens a pop over that has a

  • 0

I have two views, the parent view opens a pop over that has a child view.

In child controller
@property (nonatomic, assign) ParentController *parent;

In parent controller
ChildController *child = [[ChildController alloc] init];
child.parent = self;

My question is in the dealloc method of the child controller, do you set self.parent = nil or 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-16T18:12:03+00:00Added an answer on May 16, 2026 at 6:12 pm

    This has a bad code smell. It doesn’t make much sense and I’m surprised it compiles:

    ChildController *child = [[ParentController alloc] init];
    

    And I’m not sure what you mean by “pop over” — that term has a specific meaning now in iOS (see: Consider Using Popovers for Some Modal Tasks in the iPad Human Interface Guidelines).

    Your question “in the dealloc method of the child controller, do you set self.parent = nil or release?” can’t be answered properly, as it’s also a bad code smell. There’s no reason for a child view controller to be fiddling with any reference to a parent view controller like that.

    (Although some people have answered your question while I was typing this up, I think you have some design problems that need to be acknowledged)

    How are you presenting your “ChildView”? Modally? If so, your code might look something like this:

    - (void)showChildView
    {
        ChildViewController* childViewController = [[ChildViewController alloc] initWithNibName:@"ChildView" bundle:nil];
        childViewController.delegate = self;
        childViewController.someProperty = @"Some Value";
        [self.navigationController presentModalViewController:childViewController animated:YES];
        [childViewController release];
    }
    

    You should then create a delegate protocol with your ChildViewController class that your ParentViewController class will implement, so it knows when the ChildViewController is finished so it can deal with removing the view appropriately.

    Generally, the idea of the ChildViewController needing a pointer back to the ParentViewController is a bad code smell because it sets up a circular dependency.

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

Sidebar

Related Questions

I have a Delphi 7 application that has two views of a document (e.g.
I have a NavigationBar app with two views: a parent and a sub view.
I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
I have a view that is joining two tables and ordering by the first
I have two threads in an Android application, one is the view thread, and
I have two applications written in Java that communicate with each other using XML
I'm building a Qt application that have about 30 different views (QWidgets). My idea
I have two strongly Typed partial views (Developers list and Testers list) and the
The problem is that I have two listView but one itemClick method, if I
Here is my situation - I have two nested view models: <%=Html.EditorFor(x => x.DisplayEntitiesWithRadioboxesViewModel)%><br

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.