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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:00:58+00:00 2026-05-23T17:00:58+00:00

I used Interface Builder to connect GUI elements to IBOutlet in view controller, but

  • 0

I used Interface Builder to connect GUI elements to IBOutlet in view controller, but not sure when do I need to release them, in viewDidUnload or dealloc? Or both?

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-05-23T17:00:59+00:00Added an answer on May 23, 2026 at 5:00 pm

    Assuming they’re properties, you should set them to nil in both viewDidUnload and dealloc, making sure to use the setter. So e.g.

    self.imageView = nil;
    self.segmentControl = nil;
    /* etc */
    

    Setting a retain property to nil has the effect of releasing the object and setting the instance variable to nil (so it’s safe to do the same thing again even without gaining a new object in between).

    viewDidUnload is called when your view controller’s view has been ejected from memory, which can happen when a memory warning occurs and your view controller isn’t currently using its view. If you’ve retained some subviews for yourself (implicitly, via a ‘retain’ setter or deliberately) and don’t release them, they’ll stay in memory. You don’t want them to do that because you’re required to free as much memory as possible upon receipt of a memory warning and you or other processes could be terminated if not enough memory is freed system wide. So it’s both to be kind to your user and to be a good citizen.

    The same advice applies whether you’ve got retain or assign properties; if they’re retained then setting the property to nil will release, if they’re just assigned then setting the property to nil will prevent you from keeping a dangling pointer.

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

Sidebar

Related Questions

I used the Interface Builder to create a table view, to which I added
Interface Builder can be used for basic dependency injection in a Cocoa app, but
I used Interface Builder to set custom row height to 88.0, but when app
I used this guide: http://www.bdunagan.com/2009/06/28/custom-uitableviewcell-from-a-xib-in-interface-builder to be able to create my own custom UITableViewCell
I have two View Controllers: TableViewController (which is used as a modal view controller)
I'm trying to use Xcode 4's Interface Builder, but I'm a bit lost when
I so far only have the interface builder layout I'm not clear on the
I am working on a GUI in Interface Builder for an iPhone app. In
I've got an interface which i've used StructureMap to Dependency Inject . public interface
When designing a user interface for an application that is going to be used

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.