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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:43:02+00:00 2026-05-26T20:43:02+00:00

I am using a UIView animation to move a button across the screen. While

  • 0

I am using a UIView animation to move a button across the screen. While it is moving, I have an NSTimer running the method

checkForCollision

which looks like this:

for(UIButton* b in squares)
    if(CGRectIntersectsRect(playerSquare.frame, b.frame)) {
        [self showEndMenu];
        break;
    }

with an interval of .05; I would like for that method to notify me any time the button moves across the path of another. The problem, it appears, is that when it checks for the frame of the UIButton b, it only sees the frame towards which the button is moving.

I have the button being animated like this:

[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:1.3];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
view.center = destPoint;
[UIView commitAnimations];

So, if the destPoint intersects the CGRect playerSquare.frame, [self showEndMenu] is called. But if the frame / position at which the button is, say, halfway through the animation, intersects playerSquare, [self showEndMenu] doesn’t get called. I don’t know how to solve this; I can provide more code if need be. Thank you!

  • 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-26T20:43:02+00:00Added an answer on May 26, 2026 at 8:43 pm

    Moving views by animating their properties immediately sets the property to the final value, as you have found.

    You _may_be able to get the intermediate values out using the core animation layers (see http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/PropertyAnimations.html#//apple_ref/doc/uid/TP40006672-SW1 typing on phone sorry for poor link) but honestly I’ve not got any experience with that. If anyone does it would be great to see it here. In fact, a quick search has turned up this question, with the exact answer you are looking for, I think 🙂

    UIView animation determine center during animation

    Your other option is to move the button iteratively using timers, in the same way that objects are moved around using cocos2d, so when you are checking for position each time then your buttons are where they really are. However this way you have to calculate the path yourself.

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

Sidebar

Related Questions

I have an animation I'm using to snap a rotatable UIView to a circular
I'm using UIView's + animateWithDuration:delay:options:animations:completion: method to move my view along a line over
I'm using UIView class method animateWithDuration for repeating my view animation. How can I
I am trying to mimic UINavigationController's pushViewController using UIView animation but I have seem
I have an application where I'm moving my entire UIView up when using the
I am doing a basic UIView animation using block code. I am simply moving
I have a UIView that contains a number of CALayer subclasses. I am using
I have refactored some UIView sub-classes into a static library. However, when using Interface
I have a UIScrollView subclass that I am programmatically scrolling using UIView animations. I'd
I crated a zoom animation using CGAffineTransformScaleMake, [UIView beginAnimations:nil context:view]; [UIView setAnimationDuration: 0.4f]; [UIView

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.