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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:33:26+00:00 2026-05-21T21:33:26+00:00

I want to implement a simple animation based on UIView’s center property. I have

  • 0

I want to implement a simple animation based on UIView’s center property. I have a simple view and I can drag it (UIView touchesMoved is overriden). The animation should fade slowly like the view is moved under it’s own inertia for some time after the user releases it. But for now I want simply to move the view after touch ends. Here is the code I have in touchesEnded:

int i;
    for (i=1;i<4;i++)
    {
        self.center = CGPointMake(10*i, 12*i);
        [self setNeedsDisplay];
        usleep(100000);
    }

The problem is when I run this, the code is executed nicely but “UIView” changes to late. I changed usleep time and other parameters but the result is the same. It looks like all the “pending changes” in the view are performed only after the overriden touchesEnded is finished.

Is this the right way of implementing such user interface feature or should I look for some other approaches?

Thanks in advance.

  • 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-21T21:33:26+00:00Added an answer on May 21, 2026 at 9:33 pm

    If you know the final positions you want your view center to have you could do this with an animation:

    [UIView animateWithDuration:20
                          delay:0
                        options: UIViewAnimationOptionCurveEaseIn
                     animations:^{
                             youView.center = CGPointMake(newCenterX, newCenterY);
                           }
                           completion:^(BOOL finished){ 
                           }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple animation based on jQuery fadeIn and fadeOut - it just
Hi I want to implement a very simple game on iphone. I have a
I want to implement a simple debug log, which consists of a table into
I want to implement a simple 2 part FormWizard. Form 1 will by dynamically
I know it's simple to implement, but I want to reuse something that already
I want to implement user stories in a new project where can i find
I want to fake a simple animation on page load by sequentially revealing several
I want to implement a simple VersionedModel base model class for my app engine
In simple words, I want to implement a function like that: let myfunction (scalar
Hi i want to implement a copy feature so that i can right click

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.