auto-rotation

Disable other fragments in auto rotation

耗尽温柔 提交于 2019-12-12 01:36:43
问题 i have an app with various fragments and the problem is when the phone rotates, the app displays other fragments from the begining. it does not close the current fragments but looks like layers on top of each other. any help i'd be grateful. thanks 回答1: Try this to add in your AndroidManifest <Activity .... .... android:configChanges="orientation|screenSize"> 回答2: You need to check for a savedInstanceState , and if it exists, don't re-create your fragments. just check if is null or not as

Autorotation crash in iOS

僤鯓⒐⒋嵵緔 提交于 2019-12-11 03:43:47
问题 I am getting abnormal termination (crash) with the App which I am working with when I am changing the device orientation. I am unable to reproduce it so often (it's not happening always when I am rotating, let's say the chance would be some where around 0.01%), but it's a serious problem. I am attaching an important part of a crash report. Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x6563616e Crashed Thread: 0 Thread 0 name: Dispatch queue: com.apple

restricting autorotation on certain views

三世轮回 提交于 2019-12-11 00:14:44
问题 my app contains two table view controllers. in the first one i want the view to be able to be rotated left and right (in addition to the portrait mode), however in the second table view controller ( which i navigate to after tapping a cell from the first table) i want it to only be viewed in portrait mode. i tried this code but it didn't work, it keeps on rotating. - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } - (BOOL) shouldAutorotate { return NO

auto-rotation in iOS5/6?

本小妞迷上赌 提交于 2019-12-10 17:35:58
问题 I updated to Xcode 4.5 and am working with iOS6--a mistake I will definitely not make next time there's an update; it's been sort of nightmarish for somebody so new to iOS--and I've just noticed an app I'm working on is autorotating. I never noticed it autorotatin before the update, but it's also possible I just didn't rotate the phone while testing, so I can't be sure. I've added the following code to the main UIViewController and it's still rotating: - (BOOL

preferredInterfaceOrientationForPresentation must return a supported interface orientation (iOS 6)

北慕城南 提交于 2019-12-10 15:33:59
问题 My application window's root view controller is a subclassed UINavigationController. I have added this code to the class: - (BOOL)shouldAutorotate { return [self.topViewController shouldAutorotate]; } - (NSUInteger)supportedInterfaceOrientations { return [self.topViewController supportedInterfaceOrientations]; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return [self.topViewController preferredInterfaceOrientationForPresentation]; } In my root UIViewController I

ios6 autorotation portraitupsidedown to portrait

不打扰是莪最后的温柔 提交于 2019-12-08 13:29:25
问题 Please don't suggest me it is a bad idea to have the rotation at ios 4.3-6.0 in 1 build, because I told to many times and didn't listen to me. At project settings I have setted all interface orientations to be supported, just to be sure. Right now I am testing on ios6 with iphone4. Starting at app delegate it is a code, like this: mainController = [[MainViewController alloc] initWithNibName:nil bundle:nil]; navigationController=[[RotatingNavigationController alloc] initWithRootViewController

Force landscape orientation in one view controller

百般思念 提交于 2019-12-07 23:59:57
问题 In iOS 5 and 6 I was doing this in the viewWillAppear method in my view controller: UIViewController *c = [[UIViewController alloc] init]; //To avoid the warning complaining about the view not being part of the window hierarchy [[[TWNavigationManager shared] window] addSubview:c.view]; [self presentModalViewController:c animated:NO]; [self dismissModalViewControllerAnimated:NO]; [c.view removeFromSuperview]; I also added this method in the app delegate - (NSUInteger)application:(UIApplication

Detect rotation changes in iOS

馋奶兔 提交于 2019-12-06 17:46:19
问题 I am making an iOS app that needs to do a little interface rearrangement upon rotation. I am trying to detect this by implementing - (void)orientationChanged:(NSNotification *)note , but this gives me notifications for when the device is face up or face down. I want a way to just get notified when the interface changes orientations. 回答1: Since iOS 8, above methods were deprecated, and the proper way to handle and detect device rotation is: -(void) viewWillTransitionToSize:(CGSize)size

Force landscape orientation in one view controller

北城余情 提交于 2019-12-06 10:28:59
In iOS 5 and 6 I was doing this in the viewWillAppear method in my view controller: UIViewController *c = [[UIViewController alloc] init]; //To avoid the warning complaining about the view not being part of the window hierarchy [[[TWNavigationManager shared] window] addSubview:c.view]; [self presentModalViewController:c animated:NO]; [self dismissModalViewControllerAnimated:NO]; [c.view removeFromSuperview]; I also added this method in the app delegate - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return [

Detect rotation changes in iOS

谁说我不能喝 提交于 2019-12-04 23:19:00
I am making an iOS app that needs to do a little interface rearrangement upon rotation. I am trying to detect this by implementing - (void)orientationChanged:(NSNotification *)note , but this gives me notifications for when the device is face up or face down. I want a way to just get notified when the interface changes orientations. Since iOS 8, above methods were deprecated, and the proper way to handle and detect device rotation is: -(void) viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id )coordinator; To detect device orientation, you should (according to documentation):