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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:00:41+00:00 2026-05-25T12:00:41+00:00

If a UIviewController subclass is created, the method ‘dealloc’ is created automatically for you.

  • 0

If a UIviewController subclass is created, the method ‘dealloc’ is created automatically for you.

- (void)dealloc{}

However, when I create a Objective-C Class, the method is not auto-created. Is it necessary to add the dealloc method so that I can release the properties in the class? Especially if I have retained them in the header file?

For example in my Objective-C class header file I have

@interface ClassA : NSObject 
{
    NSString *someProperty;
    UINavigationController *navcon;
}

@property (nonatomic, retain) NSString *someProperty;
@property (nonatomic, retain) UINavigationController *navcon;

Do I need to manually create a dealloc method to release the properties as below?

-(void)dealloc
{
    [someProperty release];
    [navcon 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-25T12:00:42+00:00Added an answer on May 25, 2026 at 12:00 pm

    Yes you must.

    dealloc is called upon your object before it is destroyed for good and its memory is returned to the OS. If it holds onto other objects, such as in your case, it is important for those objects to be released too.

    That’s why you need to override dealloc and release any resource you are holding to there.

    The fact that some Xcode template may or may not provide you with a sample implementation of dealloc is irrelevant.

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

Sidebar

Related Questions

I have a UIViewController subclass called TripViewController. This class has the following method: -
I created an UIViewController subclass, and figured out that the default implementation of -loadView
I've got a UIViewController and an own class, a subclass of UIView. In my
In a UIViewController subclass I create a bar button item that fires an event
Here is what I do: 1) Create New UIViewController subclass , tick with NIB
I create new Window-Based project in xCode and a subclass of UIViewController name Main
I have a parent class (A) that is UIViewController. Than i create class B
I have a root UIViewController subclass that has a UITabBar, (I'm not using UITabBarController)
So I have: created a couple of custom controllers (add file UIViewController subclass) in
I have a custom UIViewController subclass and I want to override the loadView method.

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.