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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:52:42+00:00 2026-05-30T08:52:42+00:00

Hi every one here is my code: -(void) createNewImage { [imageView setCenter:[self randomPointSquare]]; [[self

  • 0

Hi every one here is my code:

-(void) createNewImage {


[imageView setCenter:[self randomPointSquare]];
[[self view] addSubview:imageView];

[views addObject:imageView];
[imageView release];

ix=imageView.center.x;
iy=imageView.center.y;
[XArray addObject:[NSNumber numberWithFloat:(240 - ix)/diviseurVitesse]];
[YArray addObject:[NSNumber numberWithFloat:(160 - iy)/diviseurVitesse]];

}

-(void)moveTheImage{
    for (NSUInteger i = 0; i < [views count]; i++) {
    imageView = [views objectAtIndex:i];
    X = [[XArray objectAtIndex:i] floatValue];
    Y = [[YArray objectAtIndex:i] floatValue];
imageView.center=CGPointMake(imageView.center.x + X, imageView.center.y + Y);

}
With this code, image are created and move to the center of the screen but after some seconds the performance decrease and come to 30fps. I would like to keep fps at 60 but I don’t know how to proceed.Some people say that I can use pool but it’s hard for me to use it because I don’t really know how to use it :/ sorry for my english I’m french :/

  • 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-30T08:52:43+00:00Added an answer on May 30, 2026 at 8:52 am

    Your problem is most likely here – [views addObject:imageView];. Adding object to a persistent dataset like NSMutableArray retains the object, so memory consumption actually grows. Try manipulating your images in [self.view subviews] without storing them in array.

    EDIT: Your code should look something like this

    - (void)createAndMove {
    
    UIImageView *imageView = [UIImageView alloc] initWithImage:image];
    [imageView setCenter:[self randomPointSquare]];
    [self.view addSubview:imageView];
    
    [UIView animateWithDuration:5 animations:^{
    imageView.center = self.view.center;
    }];
    
    }
    

    EDIT 2:

    - (void)moveImages {
      for (UIImageView *img in [self.view subviews]) {
      [UIView animateWithDuration:5 animations:^{
        img.center = self.view.center;
      }];
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code is here: -(void)loadDataFromDisk { [dict release]; NSMutableData* data = [NSMutableData dataWithContentsOfFile:[self pathForDataFile]];
I am Unit Testing one of my functions. Here is my code: public void
Such a junit : @Test public void testA { //some code here... } @Test
hello every one i am facing a strange problem i my code i am
hello every one I want to ask a question about forking here is the
Here is my picking code public static void pick(GL11 gl){ int[] viewport = new
Hi every one for some reasons i can't use shake API , so iam
I have implemented a custom UrlAuthorization module as shown here The code is as
i have to capture screenshot of Desktop after every one second. in Winform application
I have this code to change the number in the NSString every five seconds.

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.