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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:35:43+00:00 2026-05-21T02:35:43+00:00

Hy, I my application I want to animate an UIView by changing it’s position

  • 0

Hy,

I my application I want to animate an UIView by changing it’s position and rotation at the same time.
The issue is that sometimes the animation is changing the width and height of the UIView.

The animation code is this one:

int shuffleFrameX = (int)self.gameView.frame.size.width - (int)myView.frame.size.width;
int shuffleFrameY = (int)self.gameView.frame.size.height - (int)myView.frame.size.height;

int x = arc4random()%shuffleFrameX;
int y = arc4random()%shuffleFrameY;

CGRect newFrame = CGRectMake(x, y, myView.frame.size.width, myView.frame.size.height);

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];

if(isPieceRotationActive)
{
    int fact = arc4random()%4;
    myView.transform = CGAffineTransformMakeRotation(DegreesToRadians(90*fact));
    [myView setPieceRotation:fact];
}

[myView setFrame:newFrame];
[UIView commitAnimations];

This animation is repeated between 2 and 5 times using a the delegate functions. I did not copied them here.

Any idea what am I doing wrong?

Thanks!

  • 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-21T02:35:43+00:00Added an answer on May 21, 2026 at 2:35 am

    I think you should be using bounds instead of frame. The frame will increase in size as a rotation is made on a rectangle to hold the rotated rectangle, the bounds will not since the bounds represents the internal coordinates of the rotated rectangle

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

Sidebar

Related Questions

I am developing one application.In that i want to move the uiview from right
I'm trying to animate a simple ImageView in my application and I want it
I want create an application with animate button? how can i do? after click
I have a fairly simple iPhone application that I want to have run on
Hej folks, I got an UIView in my application and want to implement kind
In my AIR application, I want to animate an HTML element using jQuery. When
I have an IPhone application that I want to attempt login and do some
I have a UIView that I would like to animate into the screen in
I need some informative help about animation. Want to add animation in iPhone Application..
i'm developing an iOS 5 application. I want to resize a UIView programmatically, using

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.