Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make sure my view is oriented properly after full screen video?

I've got a universal ipad/iphone app that allows the user to watch a video, which they can then expand into full screen mode.

I have implemented (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration, and in that method I perform various setFrame calls on my view elements depending on whether they are in landscape or portrait orientation.

That all seems to work fine in normal use, i.e. rotating back and forth works fine.

But if the user starts in portrait mode, starts a video, goes to full screen mode, turns into landscape orientation, and then the video stops -- the elements are often not resized properly. They appear to be sized still as if they are portrait mode.

If I then turn to portrait mode, and then turn back to landscape, the view resets correctly.

The strange part is, I have implemented (void)exitedFullscreen:(NSNotification*)notification and in there I print out the orientation, and it's seen correctly. I also call my code to reset the view elements based on the current orientation, and I am still having this problem.

Another related issue is sometimes when dealing with rotation, my views will end up too far up the screen, actually going under the status bar at the top of the device.

Edit Here's the latest example. I rotate to landscape mode during full screen video playback, and then when I left full screen video, you can see the issue with the navigation bar at the top of the view.

Navigation bar goes underneath status bar after rotation during full screen video.

like image 575
Mason G. Zhwiti Avatar asked Apr 07 '12 18:04

Mason G. Zhwiti


1 Answers

One possible way to solve this is by presenting your view controller modally instead of using the navigation view controller.

Refer to Kenny's answer at Problem pushViewController from Landscape to Portrait

like image 167
nhisyam Avatar answered Sep 19 '22 12:09

nhisyam