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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:54:43+00:00 2026-06-05T20:54:43+00:00

I have added an UIImageView as a subview in UIView , and then I

  • 0

I have added an UIImageView as a subview in UIView, and then I move this subview with the following code in UITouchesBegan.

CGPoint newTouch = [[touches anyObject] locationInView:self]; 
     CGPoint lastTouch = [[touches anyObject] previousLocationInView:self];

    float xDif = newTouch.x - lastTouch.x; 
    float yDif = newTouch.y - lastTouch.y;
    translate = CGAffineTransformMakeTranslation(xDif, yDif);
    [self setTransform: CGAffineTransformConcat([self transform], translate)];

then I rotate this subview with the following code.

self.transform=CGAffineTransformRotate(self.transform, RADIANS(180));

at this stage, all is well..
but when I try once more to move my Subview, it moves in the opposite direction i.e. when I want to move it upwards it moves downwards.

any ideas? suggestions?

  • 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-06-05T20:54:45+00:00Added an answer on June 5, 2026 at 8:54 pm

    Why are you moving the subview using a translate transform? Just update the center property. The problem with using a translate transform is that if it is rotated, it will indeed translate in a direction relative to the current rotation (which may not be what you expected, as you have discovered). If you want to insist on using the translate transform (again, why?) then you need to make sure you are rotated back to 0 (neutral), do your translation of position, then rotate back to your desired rotation.

    Order of transforms matter.

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

Sidebar

Related Questions

i have a UIView UIImageview UIButton and UISlider added as subview to UIView example:
I have one uiimageview which is added as subview in uiview. frame for uiimageview
In my program, I have added a UIImageView as a subview of a UIView
Situation is like this I have a UIImageView say imvObj in a UIView say
I have added some code which compiles cleanly and have just received this Windows
I have a UIView and i have multiple UIImageView's as its subview. I have
I created a UITableViewCell in Interface Builder which I have added a UIImageView and
I have added an extra field Specification in Catalog->Product->Data tab. This text is stored
I have created a UIView as a subview and to that subview I have
I have added a subview over my UITableView using: TransparentViewController *tvc = [[TransparentViewController alloc]

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.