autorotate

Prevent autorotate for one view controller?

蹲街弑〆低调 提交于 2019-11-30 03:55:09
My app can autorotate but I need one of the views to only show in portrait mode and don't know how to achieve this. I tried this (among other things) but the view in question still rotates: // ViewController.m -(BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } Can someone kindly point out what I'm doing wrong? Thanks. -edit- It's for iOS 6.1 When a UINavigationController is involved, create a category on the UINavigationController and override supportedInterfaceOrientations . #import "UINavigationController

“viewWillTransitionToSize:” not called in iOS 9 when the view controller is presented modally

北战南征 提交于 2019-11-30 00:31:52
问题 I present a view controller from another one: - (void)showModalView { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; MySecViewController *mySecViewController = [storyboard instantiateViewControllerWithIdentifier:@"secController"]; mySecViewController.delegate = self; [self presentViewController:mySecViewController animated:YES completion:nil]; } Then in the presented UIViewController , the method viewWillTransitionToSize:withTransitionCoordinator: is called

How to rotate sub-views around their own centres?

♀尐吖头ヾ 提交于 2019-11-29 21:20:15
Is it possible to rotate a view around its own centre? In my present implementation the sub-views (buttons, etc) seem to move along a funny path before they end up in the desired positions (since the super view's coordinate system is rotated). I would like the views to spin 90 degrees around theire own centres as in the picture below. I really like this question. I also find the rotation animation jarring for some interfaces. Here's how I would implement what you have pictured. A simple @interface will be just fine. Note: I am using ARC. #import <UIKit/UIKit.h> @interface

UiSplitViewController doesn't autorotate

两盒软妹~` 提交于 2019-11-29 00:14:55
I have recently run into a problem. My iPad app is somehow preventing the iPad from auto-rotating. My app loads a UISplitView with both of the view controllers returning YES for shouldAutorotateToInterfaceOrientation:. I have set up my info.plist to include the "Supported interface orientations" key with all four orientations. When I run the app, however, rotating the device does not rotate the splitView (even though I am receiving UIDeviceOrientationDidChangeNotification). In addition, when I exit my app in a different orientation that it started in the iPad home screen doesn't autorotate to

How to rotate sub-views around their own centres?

淺唱寂寞╮ 提交于 2019-11-28 17:26:10
问题 Is it possible to rotate a view around its own centre? In my present implementation the sub-views (buttons, etc) seem to move along a funny path before they end up in the desired positions (since the super view's coordinate system is rotated). I would like the views to spin 90 degrees around theire own centres as in the picture below. 回答1: I really like this question. I also find the rotation animation jarring for some interfaces. Here's how I would implement what you have pictured. A simple

android maps auto-rotate

℡╲_俬逩灬. 提交于 2019-11-28 16:25:10
If you open the Google maps app, there is a button on the top right of the screen that you can press to center the map on your current location. The button's icon then changes. If you press the same button again, the map auto-rotates based on your compass heading. In other words, the map becomes egocentric (as opposed to allocentric AKA north always up). Google recently launched maps API V2 for Android and I certainly like it more than the old one. By default, android maps V2 will include the "center on location" button. However, pressing it more than once does not enable auto-rotation; it

How to get the screen auto-rotate's status?

拥有回忆 提交于 2019-11-28 10:33:34
How to get the screen auto-rotate's status (disable or enable) by Regetry or ACPI in windows8? I need to disable screen auto-rotate, and I will use winkey + O to change the screen auto-rotate control. Does anyone have similar experiences? Below maybe helpful if you want to change auto-rotate status: //C++ typedef BOOL (WINAPI* SETAUTOROTATION)(BOOL bEnable); SETAUTOROTATION SetAutoRotation = (SETAUTOROTATION)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), (LPCSTR)2507); if(SetAutoRotation != NULL) { SetAutoRotation(TRUE); } or //C# [DllImport("user32.dll", EntryPoint = "#2507")] extern

Disable autorotate on a single subview in iOS8

妖精的绣舞 提交于 2019-11-28 10:25:18
I'm writing a drawing app and I don't want the drawing view to rotate. At the same time, I want other controls to rotate nicely depending on the orientation of the device. In iOS 7 I've solved this via: - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { float rotation; if (toInterfaceOrientation==UIInterfaceOrientationPortrait) { rotation = 0; } else if (toInterfaceOrientation==UIInterfaceOrientationLandscapeLeft) { rotation = M_PI/2; } else if (toInterfaceOrientation==UIInterfaceOrientationLandscapeRight) {

AS3 - iOS force landscape mode only?

六月ゝ 毕业季﹏ 提交于 2019-11-28 04:04:49
问题 I've built a game for iOS that is designed for landscape mode and it works just fine except that if you turn the device to portrait mode it stops there to with the interface only filling about the middle half of the screen. How can I force the app to only allow the two landscape modes and not stop at the portrait position. I've tried all the publishing settings. Aspect Ratio is set for Landscape and Auto Orientation is checked on, if I uncheck AUto Orientation that the app does not rotate to

setStatusBarOrientation:animated: not working in iOS 6

南楼画角 提交于 2019-11-27 19:56:11
I've used this code to force an orientation change back to portrait when the user is finished watching the video (it allows viewing in landscape mode), before popping the video view controller off the navigation controller: //set statusbar to the desired rotation position [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO]; //present/dismiss viewcontroller in order to activate rotating. UIViewController *mVC = [[[UIViewController alloc] init] autorelease]; [self presentModalViewController:mVC animated:NO]; [self dismissModalViewControllerAnimated