uideviceorientation

Correct orientation after UIActivityViewController is dismissed

▼魔方 西西 提交于 2020-01-05 00:49:23
问题 I am presenting UIActivityViewController from my controller. I've encountered issues with rotations. After some data sharing option is chosen, let's say "Mail", mail compose view controller is presented. But if I rotate the device and dismiss the mail controller afterwards, my VC is not rotated to the current orientation. I've tried to set up the completion handler for UIActivityViewController as following: 1) [activityViewController setCompletionHandler:^(NSString *activityType, BOOL

iPhone - Screen Rotation?

南楼画角 提交于 2019-12-30 07:25:16
问题 What's the difference between UIDeviceOrientation & UIInterfaceOrientation ? Which one should I use to detect rotation on a UIView? 回答1: 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

Get device current orientation (App Extension)

你说的曾经没有我的故事 提交于 2019-12-28 13:19:07
问题 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:

Can a viewcontroller presented modally over current context (UIModalPresentationStyleOverCurrentContext) be rotated with device?

此生再无相见时 提交于 2019-12-23 01:19:13
问题 I have a controller which should be rotated with interface (device) orientation change. I track orientation changes, however i'm unable to rotate the view with the device orintation changes. I can animate the views inside, and switch their constraints etc, but i'd like to use Size classes for that. When i switch to UIModalPresentationStyleCurrentContext on presenting the controller it works, but messes with my navigation and tabbar, and i would like to do it this way. Can it be done this way?

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

[亡魂溺海] 提交于 2019-12-22 13:56:49
问题 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

when iphone Device orientation is face up/down, can I tell if it´s landscape or portrait?

半城伤御伤魂 提交于 2019-12-21 06:58:31
问题 I got this code that if the device is in landscape left/right or upside down it rotates and shows another view controller. but if it´s in the orientation face up or face down, then how can I tell if it´s in landscape mode or portrait? cause I only want to rotate if it´s face up or down and in landscape mode - (void)viewDidAppear:(BOOL)animated { UIDeviceOrientation orientation = [[UIDevice currentDevice]orientation]; NSLog(@"orientation %d", orientation); if ((orientation == 2) ||

Disable taking images in any orientation other than Portrait AVFoundation

给你一囗甜甜゛ 提交于 2019-12-20 10:37:45
问题 I am using AVFoundation to show the camera. I would like to prevent the camera itself to rotate so the viewer will see the camera only in portrait and the images will be taken only in portrait mode. I defined Supported Interface Orientation to support portrait only and the view itself is being displayed only in portrait mode, but not the camera - is being rotated with the device orientation How can I force the AVFoundation camera to be displayed and capture images only in portrait like the

How to make only MPMoviePlayerController in both landscape and portrait mode

↘锁芯ラ 提交于 2019-12-12 01:08:41
问题 I am working on a application which has to play videos when clicking on some thumbnail, I am displaying list. I want only the Video to rotate in Landscape and Portrait Mode but other screens must in Portrait Mode How can we do this. 回答1: In ViewWillAppear UIViewController *vc = [[UIViewController alloc] init]; [self presentViewController:vc animated:NO completion:NULL]; [self dismissViewControllerAnimated:NO completion:NULL]; This will trigger the redrawing of the view and thus calling

Stop Device orientation

ⅰ亾dé卋堺 提交于 2019-12-11 07:34:20
问题 While running my app I get errors which indicate that rotation notifications are being sent and crashing the app. Is there a way I can stop all rotation events from being sent to see if I can stop the crashes. Also is there a good overview of how these events should be handled. Do I have to handle them separately in in controllers or in all views. For the moment I would be quite happy to lock in portrait. I have tried calling [[UIDevice currentDevice] endGenerating Device

handling ios device orientation

為{幸葍}努か 提交于 2019-12-10 18:34:42
问题 I am having issues with my uiviews depending on the devices orientation... The main issue that I am having is that UIDeviceOrientationFaceUp UIDeviceOrientationFaceDown are messing with my view I only want to support Portrait and landscape (left right) so if the device changes orientation my view alters itself correctly.. this is what I have implemented at the moment. Basicly its a UIView that scrolls up from the bottom of the screen and has several buttons in this view that the user is able