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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:43:03+00:00 2026-05-20T04:43:03+00:00

I have a scroll view holding a few images, each one is around 100KB.

  • 0

I have a scroll view holding a few images, each one is around 100KB. I add them to uiscrollview by creating uiviewcontrollers to hold them. controllers are stored in the scrollview. I remove its view from superview and replace it by some string when the image scrolls out of visible area. I think I’m doing fine. But I still got crash after scrolling a few times(even scroll forth and back on the same 5 images).

I noticed every controller’s dealloc is called when it’s removed from the scroll view, but not its viewDidUnload.

Any help is appreciated.

  • 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-20T04:43:03+00:00Added an answer on May 20, 2026 at 4:43 am

    viewDidUnload is called when the viewController itself released its view. It is not called if you released the view (which means viewDidUnload is only relevant in the memory warning situation). In order to completely delete a view and its view controller, you should remove the view from its superview, then release the view controller. Then it’s normal viewDidUnload is not called.

    It’s hard to understand how you implemented this, and why it went wrong. But let me suggest a few things.

    The view controller’s methods such as viewWillAppear, viewDidAppear, viewWillDisappear, viewDidDisappear, etc. are not useful here, because none of them can tell you the view is currently on the screen or not. The only way you can tell is to get the contentOffset of the scroll view every time a scroll happens (by delegate methods of UIScrollViewDelegate), and check yourself if those views are on the visible region or not.

    Therefore, it’s not necessary to use UIViewController there. Just use views, for example UIImageView. Dynamically create an instance of the view when it’s visible, or more desirably, when it’s near the visible area.

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

Sidebar

Related Questions

i have a scroll view with multiple images and i am using this code.
In my app I have a scroll view and four table views. Each time
I have following UI hierarchy Scroll View -->TableLayout-->Rows [each row has TextView+EditText] Problem Inside
I have scroll view with page controll i have images in scroll view i
I have a scroll view which has one UIView inside which contains the content.
I have applied scroll view to the entire layout and that layout has one
i have an scroll view and i am adding few views to that when
I have a scroll view with several views and only one view can be
I have a UIScrollView on screen. Scroll view contains a view in which are
I have two little problems with my UIScrollView. I managed to create scroll view,

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.