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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:21:51+00:00 2026-05-13T06:21:51+00:00

On simulation, after i load the UIView that contains 52 UIImageView; it takes at

  • 0

On simulation, after i load the UIView that contains 52 UIImageView; it takes at least 3 clicks before the animation begins. On the first 2 clicks, the touchesBegan is invoked. i know that because the NSLog(@”Just before for loop); was displayed on the console. However the console states that the cardAnimationArray is empty in the first 2 clicks.

Only after 3rd click, the animation begins. The weird thing is that, by clicking other cards (UIImageView) after 3rd click, the animation begins on 1st click (behaves as normal).

Somehow it just doesn’t step into the for loop in the first 2 clicks! why is this so???

MY code is as below:

     - (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 NSString *documentsDirectory = [paths objectAtIndex:0];
 NSString *myPathDocs =  [documentsDirectory stringByAppendingPathComponent:@"Cards.plist"];
 NSMutableArray *array = [[NSArray alloc] initWithContentsOfFile:myPathDocs];

 NSMutableDictionary *dict = [array objectAtIndex:self.tag];
 NSString *cardMoved = [dict objectForKey:@"Card"];

 NSMutableArray *cardAnimationPreloadingArray = [[NSMutableArray alloc] initWithCapacity:20];
 self.cardAnimationArray = [[NSMutableArray alloc] initWithCapacity:20];
 [cardAnimationPreloadingArray release];
 NSLog(@"Just before for loop");
 for (int k; k < 20; k++) {
  NSLog(@"counting i: %d",k);
  int j = k+1;
  cardMovedImageName = [NSString stringWithFormat:@"Animated %@%d.png",cardMoved,j];
  NSLog(@"cardMovedImageName %@ at %d",cardMovedImageName, k);
  UIImage *cardMovedImage = [UIImage imageNamed:cardMovedImageName];
  [cardAnimationArray insertObject:cardMovedImage atIndex:k];
 }

 CGRect selfFrame = self.frame;
 selfFrame.size.width = 110;
 selfFrame.size.height = 164;
 [self setFrame:selfFrame];
 [self.superview bringSubviewToFront:self];
 CGPoint pt = [[touches anyObject] locationInView:self.superview];
 self.center = pt;




  NSLog(@"cardAnimationArray %@", cardAnimationArray);
 self.clipsToBounds = NO;
 self.animationImages = [NSArray arrayWithArray:cardAnimationArray];
 [self setAnimationRepeatCount:1];
 self.animationDuration= 0.3;
 [self startAnimating];
 self.image = [UIImage imageNamed:cardMovedImageName];



}
  • 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-13T06:21:51+00:00Added an answer on May 13, 2026 at 6:21 am

    You never seem to assign a value to ‘k’ so it may never be less than 20.

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

Sidebar

Related Questions

This is a bank simulation that takes into account 20 different serving lines with
Running some user-load tests with jmeter, and noticed that for each page load after
The kind of simulation game that I have in mind is the kind where
I have a simulation that reads large binary data files that we create (10s
I've looked at some similar posts regarding interaction delay after page load, but I
I have an app need to load photos from simulator photo library. After I
I have a Django form which I load dynamically to a jQuery dialog after
The situation I have an ASP.NET Webform that contains some status information about a
So I have an app that needs to load a different image as the
My first problem : I am currently using $(window).load to delay the page render

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.