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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:13:48+00:00 2026-05-25T21:13:48+00:00

I have some doubt regarding retain in .h file. I know that if we

  • 0

I have some doubt regarding retain in .h file. I know that if we alloc/copy/retain than we need to release it, but in following case

@property (nonatomic, retain) IBOutlet UITableView *myTable;

Do I need to release this table view object in my dealloc. I have created this tableview using xib.

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-25T21:13:48+00:00Added an answer on May 25, 2026 at 9:13 pm

    So sayeth the docs:

    Objects in the nib file are created with a retain count of 1 and then
    autoreleased. As it rebuilds the object hierarchy, however, UIKit
    reestablishes connections between the objects using the
    setValue:forKey: method, which uses the available setter method or
    retains the object by default if no setter method is available. If you
    define outlets for nib-file objects, you should always define a setter
    method (or declared property) for accessing that outlet. Setter
    methods for outlets should retain their values, and setter methods for
    outlets containing top-level objects must retain their values to
    prevent them from being deallocated.

    And:

    When a low-memory warning occurs, the UIViewController class purges
    its views if it knows it can reload or recreate them again later. If
    this happens, it also calls the viewDidUnload method to give your code
    a chance to relinquish ownership of any objects that are associated
    with your view hierarchy, including objects loaded with the nib file,
    objects created in your viewDidLoad method, and objects created lazily
    at runtime and added to the view hierarchy. Typically, if your view
    controller contains outlets (properties or raw variables that contain
    the IBOutlet keyword), you should use the viewDidUnload method to
    relinquish ownership of those outlets or any other view-related data
    that you no longer need.

    So basically, when being loaded from a NIB/XIB, the property is used. Meaning, if you specify retain properties on your IBOutlets (which you should), you need to release them. The preferred way to do this is in viewDidUnload, using the property.

    @property (nonatomic, retain) IBOutlet UITableView *myTable;
    
    ...
    
    - (void) viewDidUnload
    {
        self.myTable = nil;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some doubts regarding the following controller action (in ASP.NET MVC, but it's
I have some files that are uuencoded, and I need to decode them, using
I have basic doubt regarding executable stored in ROM. As I know the executable
I have a very basic doubt regarding cloud computing that is catching up pretty
I am a beginner in HTTPS technology :(. I have some doubt regarding the
No doubt some of you have seen my recent posting, all regarding the same
I just need some directions regarding a problem I have, where to look, etc..
I have some doubt on wget command. Here is the thing I want to
I am beginner so have some doubt about Adobe AIR. How do I install
I have programmed an emulator, but I have some doubts about how to organizate

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.