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

  • Home
  • SEARCH
  • 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 6584137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:29:58+00:00 2026-05-25T16:29:58+00:00

It works… it doesn’t crash, and it appears to do what I need. This

  • 0

It works… it doesn’t crash, and it appears to do what I need.

This could be a design flaw of my application but its the easiest way to do what I need. Basically a view is displayed and controls within the object itself determine when it is removed from the superview (at which point it needs to be released).

At this point its easiest to do [self release], which appears to work.

However, I’m aware of object ownership, and I’m aware that instantiating an object which releases itself is not a good design of object ownership – ie the owner class (the one which instantiates the new object) should be the one which releases it. This would then, however, require me to write delegate methods calling back to the owner class, all just to release the object.

Thoughts please? 🙂

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-25T16:29:58+00:00Added an answer on May 25, 2026 at 4:29 pm

    Basically a view is displayed and controls within the object itself determine when it is removed from the superview (at which point it needs to be released).

    Usually, the superview has the retained reference to the child view, and when it gets removed, that reference is released. Why do you need to release it again?

    If you do [self release] you are removing ownership of this object from some other piece of code (that holds a retained reference to it). If you do that, that other piece of code will still have a non-nil reference to a piece of garbage memory. It seems to me that this other piece of code should be notified of this situation (and then it might as well issue the release itself).

    Once added to the superview I can just release?

    The pattern you usually see in code samples is

    UIView *view = [[UIView alloc] initWithFrame...];
    [self addSubView:view];
    [view release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This works: print Hello World%s %! But this doesn't print Hello%20World%s %! the error
This works: struct LD__32 { struct LD__32 *ld; }; But this doesn't: struct LD_32
This works, but is it the proper way to do it??? I have a
This works great at retrieving the php data for say 15 passes BUT when
This works but I'm not sure why. In function capIn() , in my mind
This works (in firefox but not ie): document.getElementById(filename+'Likes').innerHTML=result; document.getElementById(filename+'Like').setAttribute('class','hideGalleryLike'); document.getElementById(filename+'Dislike').setAttribute('class','hideGalleryLike'); I thought the jquery
This works: (+ 1 2 3) 6 This doesn't work: (+ '(1 2 3))
This works in Firefox/Safari but not on IE var h = parseInt($('#elementWhichHeightCanChange').css('height')); alert(h); on
This works fine, but I want to make it prettier - and accommodate all
This works in FF and in Chrome but the click has no action in

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.