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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:37:59+00:00 2026-05-18T05:37:59+00:00

I know a similar question has been answered before here , but I just

  • 0

I know a similar question has been answered before here, but I just want to make sure I understand it a little bit better. Here is my scenario…

I have a helper class method that is returning an allocated UIImageView, as seen below.

+(UIImageView *)tableCellButton{
 return [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image"]] autorelease];

}

Then, in one of my UIViewController methods I am using it as such..

UIImageView *imageView = [Helper tableCellButton];
imageView.frame = cell.backgroundView.bounds;
imageView.tag = 250;
[cell.backgroundView addSubview:imageView];

My question is in regards to how this memory is released. I am not using an autorelease pool(other than the application created one), and the variable is not an iVar/Property(so it won’t get released when dealloc is called). In this case am I responsible for releasing the memory after I have called it? When does autorelease come into play? Thanks for the help!

  • 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-18T05:37:59+00:00Added an answer on May 18, 2026 at 5:37 am

    A call to autorelease will cause release to be sent to the object the next time through the event loop. That will account for the alloc call you make in tableCellButton. The only other time the object is retained is inside of addSubview, which will also handle its own release of the same object. Based on the code above, then, you memory management of this object checks out.

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

Sidebar

Related Questions

I know similar flavors of this question has been asked before, but I am
I know a similar question has been posted before but I think this is
I know this question has been handeled in similar situations, regarding ASP.Net, before. But
I know a similar question has been asked before but it seemed never been
I know this question has been asked in a similar fashion before, but I
I know a similar question has been asked but I have not found a
First of all I know similar questions has been asked here, I've checked but
I know similar question has been asked but i didn't found proper answer to
sorry if a similar question has been posted before, i didn't know what terms
I know a similar question on this topic has been asked, but doesn't look

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.