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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:28:02+00:00 2026-06-11T18:28:02+00:00

I am working on a simple game for a uni assignment, and I have

  • 0

I am working on a simple game for a uni assignment, and I have completed all that is required, but I have the following irritating problem:

I have a UIImageView, (showing an image of a coin) which when the screen is tapped, animates to simulate spinning. I do this with the following code (simplified to just show relevant stuff):

- (void)spinCoin:(int)times
{
    // Create a block scoped variable to store the amount of spins.
    __block int blockTimes = times;

    // Animate the coin to spin.
    [UIView animateWithDuration:0.1
                          delay:0.0
                        options: UIViewAnimationCurveEaseOut
                     animations:^{
                         coinImageView.transform = CGAffineTransformMakeScale(0.001, 1);
                     }
                     completion:^(BOOL completed){
                         [UIView animateWithDuration:0.1
                                               delay:0.0
                                             options: UIViewAnimationCurveEaseOut
                                          animations:^{
                                              coinImageView.transform = CGAffineTransformMakeScale(1, 1);
                                          }
                                          completion:^(BOOL finished){
                                              if (blockTimes < 4) {
                                                  // Spin 4 times.
                                                  [self spinCoins:blockTimes+1];
                                              }
                                          }];
                     }];
}

This method is called in touchesEnded.

Essentially it just scales the coin image on the x axis to 0, then once that is done, scales it back to 1 (and repeats this 4 times).

This works fine despite being a bit messy (oh god blockception), but if I click the home button, then re-open the app, if I tap the screen the coin flips 1-3 times then the imageView completely disappears. There are no errors etc. in the console.

Does anyone know what could be causing this? Are there problems with Core Graphics/Animation and apps moving into out of the background?

  • 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-11T18:28:03+00:00Added an answer on June 11, 2026 at 6:28 pm

    The problem was that due to the UIImage references I was using for the coin images being set to ‘weak’, this seemed to be causing the images to be released after the application entered the background.

    Changing the attribute to ‘strong’ fixed the problem.

    Thanks all for your help :).

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

Sidebar

Related Questions

I'm working on a simple board game in qt, and i have some problem
I'm working on a textbased simple roleplaying game for my exame, but i have
I have a simple game I'm working on in py 2.7 that uses pickle
im working on a simple game like space invaders,and i got into a problem.
Good Day, I have a simple working routine in Perl that swaps two words:
I was working on a simple game app using Xcode, but when I saw
I'm working on a C project that consists of a simple game using the
Currently i am working in Simple game application, i have a doubt on glVertexAttribPointer
I'm working on a simple game. The idea of the first round is that,
So i am currently working on a simple game project that most people start

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.