I want to play video in landscape mode in fullscreen. And my application is lock in portrait mode. How to implement this. Please help me. Thanks in advance
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
I've done this in on of my app. To do this you need to check that is your viewcontroller that where you want to play a video.
The first thing you have to do is check Device Orientation to Portrait,Landscape left, Landscape right in your project target
In your AppDelegate do the below code
Simplest solution in swift 3 Add this to your app delegate:
Just call it in
- viewDidAppear:
of the presented view controller.Another way :
First, you have to understand that in order to open even just one view out of over 100 in landscape, your app should allow both landscape and portrait interface orientations. It is the case by default, but you can check it in your target's settings, General tab, Deployment Info section
Then, because you allowed both landscape and portrait for the entire app, you will have to tell every portrait-only
UIViewController
that it should not autorotate, adding this method's implementation:-Finally, for your specific landscape-only controller, and because you said you are presenting it modally, you can just implement these methods:-
Hope this will help :)
After staring at this page for almost an entire day, I finally figured out a working time saving solution for all,
Go to the project navigator, select your project and in General select just potrait in device orientation.
Also make sure that you're using a modal segue to show the landscapeController.
Now add this in your controller where in you want the landscape mode.
And that's it folks.