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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:33:15+00:00 2026-06-01T18:33:15+00:00

Does a UIView retain it’s associated view controller? For example, in the following code

  • 0

Does a UIView retain it’s associated view controller?

For example, in the following code the view is retained by the parent view. It would be handy if this view also retained its ViewController so that I could go ahead and release the controller in the loadView method.

- (void) loadView {

  ...

  MyViewController* ctrl = [[MyViewController alloc] init];
  [self.view addSubview: ctrl.view];
  [ctrl release];

}

The alternative, I suppose, is to keep track of the controller as an instance variable and release it when appropriate.

Thanks

  • 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-01T18:33:17+00:00Added an answer on June 1, 2026 at 6:33 pm

    No it doesnt. You need a member variable, as you mentioned already.

    (A view doesn’t even know its own viewController)

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

Sidebar

Related Questions

After reading: Memory management of a view controller in Objective-c and Does UIView's addSubview
Similar to SO question ref: Why does UIView:animateWithDuration complete immediately? however, my code is
How to nest multiple CA animation like UIView animateWithDuration does? For example, I need
I have a UIView for which I would like to set its borderColor: UIView
Does anyone know if there is an open source project for an UIView element
Does viewDidLoad get called when you're popping back to a UIView?
Why does this init method return an object out of scope? Using XCode 4.2,
Many people say during a view controller's viewDidUnload method you must remove subviews by
I came across the following code snippets from Apple's Documentation. The Interface is fairly
The UIKit reference says UIView is a superclass of UIWindow, but despite of this

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.