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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:26:41+00:00 2026-05-29T10:26:41+00:00

I want to provide a custom animation when the device rotates, completely overriding the

  • 0

I want to provide a custom animation when the device rotates, completely overriding the default one. What’s the best way to achieve this?

BTW, the kind of animation I’m planning is:

a) When the device goes into landscape, have a new view slide from the top as if it was falling.

b) When the device goes back to portrait, that view should slide down and dissappear.

  • 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-29T10:26:41+00:00Added an answer on May 29, 2026 at 10:26 am

    Best is subjective and dependent upon your application as a whole.

    One fairly straight-forward way of handling the rotation events is telling the system not to and handling them yourself. For your desired effect of what essentially amounts to sliding a (pre-rotated) view in from the side when the device is rotated to the side, this would seem appropriate.

    Here is a very basic sample of how to achieve such an effect.

    @implementation B_VCRot_ViewController // defined in .h as @interface B_VCRot_ViewController : UIViewController
    @synthesize sideways; // defined in .h as @property (strong, nonatomic) IBOutlet UIView *sideways;
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    -(void)orientationChange:(NSNotification *)note{
        UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
        CGSize sidewaysSize = self.sideways.frame.size;
        if (newOrientation == UIDeviceOrientationLandscapeLeft){
            [UIView animateWithDuration:1.0 animations:^{
                self.sideways.frame = CGRectMake(0, 0, sidewaysSize.width, sidewaysSize.height);
            }];
        }
        else {
            [UIView animateWithDuration:1.0 animations:^{
                self.sideways.frame = CGRectMake(self.view.bounds.size.width, 0, sidewaysSize.width, sidewaysSize.height);
            }];
        }
    }
    - (void)viewDidLoad{
        [super viewDidLoad];
        [self.view addSubview:sideways];
        self.sideways.transform = CGAffineTransformMakeRotation(M_PI_2); // Rotates the 'sideways' view 90deg to the right.
        CGSize sidewaysSize = self.sideways.frame.size;
        // Move 'sideways' offscreen to the right to be animated in on rotation.
        self.sideways.frame = CGRectMake(self.view.bounds.size.width, 0, sidewaysSize.width, sidewaysSize.height);
        // register for rotation notifications
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
        // Do any additional setup after loading the view, typically from a nib.
    }
    @end
    

    What I have done here is added a UIView with a landscape orientation in the .xib and connected it to an IBOutlet named sideways. In viewDidLoad I add it as a subview, pre-rotate it, and move it offscreen. I also add self as an observer for the device rotation notifications (Remember to remove yourself later for that notification). And in shouldAutoRo.. I indicate that this VC only handles portrait.

    When the device rotates NSNotificationCenter calls orientationChange:. At that point if the device is rotated to the left, my sideways view will slide in from the right (which seems like it’s sliding down).

    Obviously for both landscape orientations the code would be more complex. Also you would likely have to mess around with the animation timing to make it feel as if the second view is “falling”

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

Sidebar

Related Questions

I want to provide a custom Batcher for Hibernate to use (for this reason:
I want to provide an animation when my application starts. I have just one
i am having trouble with custom quick-fixes, which i want to provide in my
I want to provide dbus methods and signals on a custom bus (i.e. not
I am creating custom Swing components and want to provide a UI that looks
I want to provide a custom view in the admin very similar to changelist_view()
I want to show custom animation in my ProgressDialog . After reading few posts,
I want to provide custom paging in grid view. <asp:GridView ID=gvFirst runat=server AutoGenerateColumns=false AllowPaging=true
I want to host StyleCop in a Custom Environment, the sample code provided in
I want sell some .NET library and I want provide edition with full source

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.