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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:06:34+00:00 2026-05-25T06:06:34+00:00

One of the views in my app has a method to set it’s ‘default’

  • 0

One of the views in my app has a method to set it’s ‘default’ layout – setDefaultView. In this method, I loop through the subViews, and if one is an ImageView, it sets the image to nil.

This works fine when my app is initially launched from XCode. But, when I hibernate my app by pressing the home button, then go back into the app and trigger setDefaultView, it crashes in this method where the images are set to nil.

Any suggestions on what may be going wrong here?

Source code:

-(void)setDefaultView {

// Hide all equals labels and images; set all images to nil
for (UIView *view in [secondScrollerView subviews]) {

    if ([view isKindOfClass:[UILabel class]]) {

        UILabel *label = (UILabel *)view;

        if ([label.text isEqualToString:@"="]) {
            label.hidden = YES;
        }
    }

    if ([view isKindOfClass:[UIImageView class]]) {

        UIImageView *imageView = (UIImageView *)view;
        imageView.hidden = YES;

        imageView.image = nil;    // Crashes here
    }
}

// do other stuff here...
}
  • 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-25T06:06:34+00:00Added an answer on May 25, 2026 at 6:06 am

    Most probable is that you set the imageView.image to an autoreleased object. The imageView.image = nil; line will release the old image, which will be a problem if it is already released.

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

Sidebar

Related Questions

My app has two views, one holds the OpenGL context which is constantly redrawing
In GWT app where one has multiple presenters rendering views based on user actions/events,
In my app I have a UINavigationController. One of the views in the NavigationController
I have an app that have several views. In one view I would like
I am building an iPad app where all views should autorotate. One view is
In my iPhone/iPad app, I am adding one subview to my main view. This
I am creating a quiz app which has 2 views, MMAppViewController and a subview
This one is baffling me. If anyone has any answers, they are appreciated. I
I get this error: NoMethodError in Videos#new Showing /rubyprograms/dreamstill/app/views/videos/new.html.erb where line #1 raised: undefined
So I have two TableView in one view of an iOS app. I have

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.