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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:10:41+00:00 2026-06-03T10:10:41+00:00

When I use addSubview method and then removeFromSubview to load next ViewController then after

  • 0

When I use addSubview method and then removeFromSubview to load next ViewController then after load view some times, my app crash. I have many images on views.

I think my memory isn’t released, in spite of I use ARC.

What I should use to make it work? I tried addChildViewController, but then my view aren’t loading.

  • 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-03T10:10:42+00:00Added an answer on June 3, 2026 at 10:10 am

    As per memory management guidelines, whenever you say addSubview, the reference count increases by 1 and whenever you say removeFromSuperview the reference count decreases by one. So, if you are removing any view, that you have added to any view, the reference count should be adjusted and should not cause memory leak.

    What problem I can foresee is that you are having memory leak in the added view (the view, that you are adding multiple times) and this in order overflowing your memory. Try maintaining the reference counts and it will work perfectly. As an alternate solution, you can also track memory leaks by using instrument tools.

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

Sidebar

Related Questions

I have created a View controller with some methods I need to use often
My Setup: In my iPhone app, I have a loading View (which is an
I use UIActivityIndicator in my app. I have written code for it as follows:
I have a small MacRuby app that displays some text inside a NSTextView .
I'm aware of it's function and how to use the addSubview method. What would
I'm programming for the iPhone and I'm wondering when to use the addSubview method
I have 2 views and 1 viewController : In the first view I have
I am not able remove view. I am adding view using addsubview method but
I have created a method for example changeColor for calling the method we use
Use case: user clicks the link on a webpage - boom! load of files

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.