uideviceorientation

Locking device orientation on a view fails when going back in NavBar

谁说胖子不能爱 提交于 2019-12-06 04:17:25
I have an app with several VCs embedded in a NavigationController. I need all VCs to be locked in a portrait orientation and only one in both portrait and landscape. I've tried different approaches and this one is working for me: extension UINavigationController { public override func supportedInterfaceOrientations() -> Int { return visibleViewController.supportedInterfaceOrientations() } public override func shouldAutorotate() -> Bool { return visibleViewController.shouldAutorotate() } } And then I modify each ViewController like this: class ViewController: UIViewController { override func

Rotate totally Landscape view when movie play in VLCPlayer with swift 3

给你一囗甜甜゛ 提交于 2019-12-04 06:32:21
问题 I would like to rotate my view controller when movie play. My question might be duplicate but I tried many ways when I find in stack overflow. But all codes do not work. May be I put the codes in wrong way. override var shouldAutorotate: Bool { return false } override var supportedInterfaceOrientations: UIInterfaceOrientationMask { //return[.portrait,.landscapeRight] return .landscapeLeft } override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { //return

iOS 6 orientation issues

倖福魔咒の 提交于 2019-12-03 15:15:03
问题 I have an application which normally is a portrait app and only show landscape view for one UIViewController. It works fine until the new iOS 6 is released. I really don't understand how orientation works in iOS 6. So I wrote a testing app. Here is what I did: Set the orientation of the application to support all orientations. I'm using story board. The rootViewController is embedded in UINavigationController which is in portrait. The code in rootViewController: -(NSUInteger

Change or disable the iPhone rotating animation when orientation changes

拟墨画扇 提交于 2019-12-03 12:59:50
问题 How do I change or disable the rotating animation when screen orientation changes from landscape to portrait, or vice versa? 回答1: If you dont want your view controllers to rotate just override the shouldAutoRotateToInterface view controller method to return false for whichever orientation you dont want to support...Here is a reference. In the case that u just want to handle rotation some other way, you can return false in the above methods and register for

Change or disable the iPhone rotating animation when orientation changes

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 04:02:39
How do I change or disable the rotating animation when screen orientation changes from landscape to portrait, or vice versa? If you dont want your view controllers to rotate just override the shouldAutoRotateToInterface view controller method to return false for whichever orientation you dont want to support... Here is a reference . In the case that u just want to handle rotation some other way, you can return false in the above methods and register for UIDeviceOrientationDidChangeNotification like so NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self

Rotate totally Landscape view when movie play in VLCPlayer with swift 3

别等时光非礼了梦想. 提交于 2019-12-02 08:07:35
I would like to rotate my view controller when movie play. My question might be duplicate but I tried many ways when I find in stack overflow. But all codes do not work. May be I put the codes in wrong way. override var shouldAutorotate: Bool { return false } override var supportedInterfaceOrientations: UIInterfaceOrientationMask { //return[.portrait,.landscapeRight] return .landscapeLeft } override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { //return UIInterfaceOrientation.landscapeRight return .landscapeLeft } I put this code to vlcplayerviewcontroller.swift

iPhone - Screen Rotation?

懵懂的女人 提交于 2019-11-30 23:41:19
What's the difference between UIDeviceOrientation & UIInterfaceOrientation ? Which one should I use to detect rotation on a UIView? UIDeviceOrientation gives you information about the physical device itself while UIInterfaceOrientation tells you about the orientation of the views it is displaying. These do not need to match; when a user uses the orientation lock or if the the device orientation is face up. You probably want to be checking UIInterfaceOrientation and the rotation methods on UIViewController to determine when views have been or should be rotated. Garrett Smallwood

Can I rotate a UIView without the black bars?

蓝咒 提交于 2019-11-28 12:44:05
I have a UIView that takes up the entirety of the window on the iphone. When it rotates to landscape, the edges get the little black bars until it snaps into place, as i would expect. I want to make that uiview bigger than the screen, so that rotating it doesn't show those black bars but shows the parts of the view that are normally offscreen. I've tried increasing the frame and bounds of the view, but that doesn't seem to do the trick. Has anyone done this succesfully? You need to do two things to make this happen. First, the window's root view controller will always resize its view to the

Get device current orientation (App Extension)

点点圈 提交于 2019-11-28 08:22:05
How to get device current orientation in an App Extension, I have tried below two methods but no success. It always return UIDeviceOrientationUnknown [[UIDevice currentDevice] orientation] It shows red message that ‘sharedApplication’ is not available on iOS (App Extension) [[UIApplication sharedApplication] statusBarOrientation]; I also add an observer but it not getting called. [[NSNotificationCenter defaultCenter] addObserver:self.view selector:@selector(notification_OrientationWillChange:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; - (void)notification

Can I rotate a UIView without the black bars?

六月ゝ 毕业季﹏ 提交于 2019-11-27 07:14:08
问题 I have a UIView that takes up the entirety of the window on the iphone. When it rotates to landscape, the edges get the little black bars until it snaps into place, as i would expect. I want to make that uiview bigger than the screen, so that rotating it doesn't show those black bars but shows the parts of the view that are normally offscreen. I've tried increasing the frame and bounds of the view, but that doesn't seem to do the trick. Has anyone done this succesfully? 回答1: You need to do