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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:21:48+00:00 2026-06-12T17:21:48+00:00

I have a custom cell for my table view which I have designed using

  • 0

I have a custom cell for my table view which I have designed using interface builder. In its .m file I have some code like this to fetch the xib from the bundle for the custom cell.

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        NSArray *nibArray = [[NSBundle mainBundle] loadNibNamed:@"SubItemsCustomCell" owner:self options:nil];
        self = [nibArray objectAtIndex:0];    }
    return self;
}

Then when I use this cell in my cellForRowAtIndexPath method and pass it an autorelease message

if (!cellForSubItems) {
    cellForSubItems = [[[SubItemsCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SubItemCell"] autorelease];
}

it crashes when i scroll the tableView giving a message,

-[SubItemsCustomCell release]: message sent to deallocated instance 0xed198b0

It never crashed when I made a custom cell using code, but it does here, why is it so??
Also when I dont autorelease it, it runs absolutely fine, but obviously it will have memory leaks.
Kindly Help me out with this one. Thanks In Advance.

EDIT: I am not using ARC.

  • 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-12T17:21:49+00:00Added an answer on June 12, 2026 at 5:21 pm

    try my bellow code for add cell in UITableView

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        {
            SubItemsCustomCell *cell = (SubItemsCustomCell *) [tableView      dequeueReusableCellWithIdentifier:nil];
    
            if (cell == nil) 
            {
    
                NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"SubItemsCustomCell" owner:self options:nil];
    
                for (id currentObject in topLevelObjects){
                    if ([currentObject isKindOfClass:[UITableViewCell class]]){
                        cell =  (SubItemsCustomCell *) currentObject;
                        break;
                    }
                }
                 ///do something here
            }
    
            return cell;
        }
    

    i hope this help you…

    🙂

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

Sidebar

Related Questions

I have a custom table cell which has a custom ui view in it.
I have an UITableView showing custom view cells that I've designed in interface builder.
I have some UIButtons in a custom table view cell that when pressed I
I have a table view with a custom cell ( UISwitch on every cell
I have created a custom cell for loading into a table. The interface is
I have a table cell with a custom backgroundView which looks great while in
I have a custom UITableViewCell which I created in Interface Builder. I am successfully
I have a custom view in a custom table cell. Every time a specific
I have a custom cell that contains a button in a table view. The
I have a view based table with a custom cell view. Inside this custom

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.