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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:47:57+00:00 2026-06-03T00:47:57+00:00

My iOS has registered for device orientation change notifications via NSNotificationCenter , and has

  • 0

My iOS has registered for device orientation change notifications via NSNotificationCenter, and has a method that responds to the different orientation changes. The following code is called to change the orientation and location of a view when rotating the phone to “landscape-left”.

camAngle = [(NSNumber *)[_cameraToggleButton valueForKeyPath:@"layer.transform.rotation.z"] floatValue];
            camDegrees = (RADIANS_TO_DEGREES(camAngle));
            if (!(camDegrees == 90)) {
                _cameraToggleButton.alpha = 0.0;
                _cameraToggleButton.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90));
                _cameraToggleButton.frame = CGRectMake(274, 350, 66, 54);
                [UIView beginAnimations:nil context:nil];
                [UIView setAnimationDuration:0.4];
                [UIView setAnimationCurve:UIViewAnimationCurveLinear];
                _cameraToggleButton.alpha = 1.0;
                [UIView commitAnimations];
            }

And my equations to convert radians and degrees:

#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI))
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)

The view rotates correctly and assumes the correct position on screen, but the sides of the image are suddenly squashed, making the image look condensed. This only happens when rotating the phone into landscape position (left or right). Rotating to upside down or back to portrait translates and rotates the view fine, with essentially the same code. What could cause this skewing of the images in landscape position?

  • 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-03T00:47:59+00:00Added an answer on June 3, 2026 at 12:47 am

    You should not set the frame of the _cameraToggleButton after you set the rotation transform on it. To re-position the _cameraToggleButton after you set the rotation, you should change it’s center like so:

    _cameraToggleButton.center = CGPointMake(274, 350);
    

    Also, as someone else suggested, use UIViewContentModeScaleAspectFit instead of UIViewContentModeScaleToFill.

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

Sidebar

Related Questions

I have a callback handler registered that listens to changes in the iOS Address
Once an iOS device has acquired a GPS fix, it will cache that coordinate
The new iPhoto for iOS has a help overlay that includes controls that point
I realize that iOS has the ability to have keyboard shortcuts (e.g.: Command-C for
My iOS app has a need to uniquely identify each device so it can
Almost every ios app now has something like Feed option. Programming that usually includes
I'm working on an iOS project that has to work from iOS4. I have
I know that UIAppearance has been introduced in iOS 5, but is there any
I have a Rails app that has 2 clients -- an iOS app reads/writes
I have an iOS application. Application has 2 different views: Main and Settings. In

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.