Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually the interface of the Youtube does not really rotate, they just present the video layer full screen and rotate the layer. </p> <p>The same think happens when you rotate the device, they make the video layer fill the screen and rotate it according to the device rotation. Facebook does the same when viewing photo fullscreen and rotating the device just rotates the view.</p> <p>You can start monitoring the rotation by asking <code>UIDevice</code> to generate device notation orientation notifications:</p> <pre><code>[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:[UIDevice currentDevice]]; </code></pre> <p>Then in the <code>-(void)orientationChanged:</code> method change the UI:</p> <pre><code>- (void) orientationChanged:(NSNotification *)note { UIDevice * device = note.object; CGAffineTransform transfrom; CGRect frame = self.videoView.frame; switch(device.orientation) { case UIDeviceOrientationPortrait: case UIDeviceOrientationPortraitUpsideDown: transfrom = CGAffineTransformIdentity; frame.origin.y = 10.0f; frame.origin.x = 10.0f; frame.size.width = [UIScreen mainScreen] bounds].size.width; frame.size.height = 240.0f; break; case UIDeviceOrientationLandscapeLeft: transfrom = CGAffineTransformMakeRotation(degreesToRadians(90)); frame.origin.y = 0.0f; frame.origin.x = 0.0f; frame.size.width =[UIScreen mainScreen] bounds].size.height; frame.size.height =[UIScreen mainScreen] bounds].size.width; break; case UIDeviceOrientationLandscapeRight: transfrom = CGAffineTransformMakeRotation(degreesToRadians(-90)); frame.origin.y = 0.0f; frame.origin.x = 0.0f; frame.size.width =[UIScreen mainScreen] bounds].size.height; frame.size.height =[UIScreen mainScreen] bounds].size.width; break; default: return; break; }; [UIView animateWithDuration:0.3f animations: ^{ self.videoView.frame = frame; self.videoView.transform = transfrom; }]; } </code></pre> <p><strong>This code is written without testing and is only here to give you an idea of how it can be doen.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload