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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:04:55+00:00 2026-06-15T16:04:55+00:00

I had created a custom TableViewCell for a TableView, But the app crashes if

  • 0

I had created a custom TableViewCell for a TableView, But the app crashes if there is a dealloc method(in Custom Cell Class). Please see the below code used for table cell class :

#import <UIKit/UIKit.h>

@interface CustomTableCell : UITableViewCell {

    UILabel *nameLabel_;
    UILabel *dateLabel_;

}

@property (nonatomic, retain) IBOutlet UILabel *nameLabel;
@property (nonatomic, retain) IBOutlet UILabel *dateLabel;

@end


#import "CustomTableCell.h"

@implementation CustomTableCell

@synthesize nameLabel = nameLabel_;
@synthesize dateLabel = dateLabel_;


- (void) dealloc {

    [self.nameLabel release];
    self.nameLabel = nil;
    [self.dateLabel release];
    self.dateLabel = nil;

    [super dealloc];
}

@end

Code for Creating Custom Cell(cellForRowAtIndexPath):

UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:@"DemoCell"];

if (Cell == nil){

    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomTableCell" owner:nil options:nil];

    for(id currentObject in topLevelObjects)
    {
        if([currentObject isKindOfClass:[CustomTableCell class]])
        {
            Cell = (CustomTableCell *)currentObject;
            break;
        }
    }
}

If I remove the dealloc method from custom Cell, everything works Fine. Other wise I will get an exception(When I Scroll the table View) : -[CALayer release]: message sent to deallocated instance 0x6fbc590*

Does we don’t need a dealloc method in customTableViewCell? Please help me to find a solution for this problem.

  • 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-15T16:04:57+00:00Added an answer on June 15, 2026 at 4:04 pm

    On the face of it, you’re writing your -dealloc method incorrectly. Do it this way:

    - (void) dealloc {
    
        [nameLabel_ release];
        nameLabel_ = nil;
        [dateLabel_ release];
        dateLabel_ = nil;
    
        [super dealloc];
    }
    

    You should never use your accessors in your -dealloc method; work directly with your ivars.

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

Sidebar

Related Questions

I had created a Lib Project with a class inherits ServiceBase but when I
I had created a custom search engine on Google but the problem is that
i had created a custom checkbox cell and column just to display a text
I had created a comment app with custom field like parentId and email_notification. In
i had created a class with two properties one of datetime datatype and other
I was iterating through a table I had created and getting the first cell
I have created a custom Button class and I want to be able to
So i've created a custom TableViewCell, and in the nib I put a UISwitch
I had been created text box custom validation control and I'm using this in
Update Fixed the loading issue. As I was using a custom cell class I

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.