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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:46:51+00:00 2026-05-26T02:46:51+00:00

I have created a sample app where i have created some class inherited from

  • 0

I have created a sample app where i have created some class inherited from NSObject class for defining different atributes and properties of my object . Now i have a subclass a UIView and also able to show that object in my iphone screen.

Now i have a problem whenever i want to delete a triangle i generally call [self removeFromSuperview];and it remove the view from my screen.

But it is just removing the view from screen not completely deleting the object.

How can i delete the object completely?

  • 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-26T02:46:51+00:00Added an answer on May 26, 2026 at 2:46 am

    From what I gather from your description – how about:

    [self removeFromSuperview];
    [self release];
    

    Does that work? Alternatively, you should put this kind of logic in your view controller. Then, is you have a reference to object (say, myObject), then use:

    [myObject removeFromSuperview];
    [myObject release];
    

    Removing from the super view does not mean delete this object. Your object can very live without being connected to a UIView hierarchy.

    EDIT: (to flesh out Peter Deweese’s comment)

    When you create an UIView you can do this:

    MyView* view = [[MyView alloc] initWithFrame:myViewRect];
    [mySuperView addChild:view];
    [view release];
    

    This means that you no long own the view, but the super view does. The super view retains your view when its added as a child, and you relinquish it with release. Later, when you do:

    [self removeFromSuperview];
    

    The retain count will drop to 0 and your object will be deleted automatically.

    Good idea Peter!

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

Sidebar

Related Questions

I have created some simple app in Java, and 'deployed' it using Java Web
I have created a sample report with crystal report 10. Now, I wanna to
I have created a small and simple android app. I tried installing it on
I have created a sample java socket application. I used Socket s = new
I have created a simple map app that shows the local garage sales in
I am totally new to WPF, I have created a simple WPF app that
I'm learning NHibernate and have created some unit tests and it's going quite well.
I have created a WCF service which does not use the app.config to configure
I'm writing an MVC2 app using DataAnnotations. I have a following Model: public class
Currently, I'm elaborating with game development, and have created (with help of some online

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.