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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:16:36+00:00 2026-05-23T16:16:36+00:00

So I have this problem with an application I am building that I can’t

  • 0

So I have this problem with an application I am building that I can’t figure out.
My application has the following structure:

UITabBarController -> UIViewController -> UIViewController

The last view controller contains an UIWebView which loads an entire page. In that page there is a movie (mp4) that users can play once they hit the big round play button.

The application is made such that it runs in portrait mode, and there is no way I can do it run otherwise because of it’s initial design.

What I want to achieve is let users rotate their phones once the movie starts playing and rotate the movie accordingly. I’ve managed to ‘detect’ when the movie is played by listening to different NSNotifications that NSNotificationsCenter sends.

I used this for detecting the start:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieIsPlaying:)
name:@"UIMoviePlayerControllerDidEnterFullscreenNotification"
object:nil];

and this for detecting the end:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(movieStopedPlaying:)
name:@"UIMoviePlayerControllerDidExitFullscreenNotification"
object:nil];

With the 2 selectors now I set one global variable to YES or NO which I can use later in

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

If I always return YES from the above method my application interface rotates on every screen except when the movie is up and running. The weirdest thing is this:

  • I open the application in portrait.
  • Go to the desired page (see my structure above)
  • Rotate the phone to landscape (the interface rotates – this is just for debugging)
  • I start the movie (it launches in landscape! Hooray!)
  • I rotate the phone back to portrait (the movie rotates! Hooray again!)
  • I rotate the phone back to landscape (no more rotation occurs…)

Also if I start the movie in portrait mode it will never rotate.

Update

In the end I’ve come up with this solution for the 2 methods mentioned above:

- (void)movieIsPlaying:(NSNotification *)notification
{
    if (![Globals canRotateInterface]) {
        [Globals setCanRotateInterface:YES];
        
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
                
        [[[[notification object] view] window] setBounds:CGRectMake(0, 0, 480, 320)];
        [[[[notification object] view] window] setCenter:CGPointMake(160, 240)];
        [[[[notification object] view] window] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
    }
}

- (void)movieStopedPlaying:(NSNotification *)notification
{   
    if ([Globals canRotateInterface]) {
        [Globals setCanRotateInterface:NO];
        
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
        
        [[[[notification object] view] window] setBounds:CGRectMake(0, 0, 320, 480)];
        [[[[notification object] view] window] setTransform:CGAffineTransformIdentity];
                    
        // Little hack to force an orientation rotation so that all elements get their original size and place (eg. Navigation bar)
        UINavigationController *dummyNavigationViewController = [[UINavigationController alloc] init];
        [self presentModalViewController:dummyNavigationViewController animated:NO];
        [self dismissModalViewControllerAnimated:NO];
        [dummyNavigationViewController release];
    }
}
  • 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-23T16:16:36+00:00Added an answer on May 23, 2026 at 4:16 pm

    What I did in the end was use the 2 mentioned notifications to detect when the user plays or stops the movie and have code that rotates the window to 90 degrees. This way the user only sees the movie in landscape mode but it’s better than just seeing it in portrait.

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

Sidebar

Related Questions

I have this weird problem.. I'm building an in-house app that should register all
I have this problem in my ASP.NET application where I'm seeing some of my
I have had this problem w/ two seperate WYSWYG editors in my rails application
I have this idea for a free backup application. The largest problem I need
I have this .bat script which I use to maven package my application. Problem
I have this problem that my sites uses alot of ajax and when a
Does anyone have experience building a .NET test execution harness that can execute the
I'm building a Qt application that have about 30 different views (QWidgets). My idea
Greetings, I have a problem in my application I'm building in. To give the
We're building a Windows-based application that traverses a directory structure recursively, looking for files

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.