Last Activity orientation changed when new activity orientation in landscape - android-activity

I have Two Activities A and B orientation of A is fixed in Portrait and B orientation can be change in landscape and portrait.When user at Activity B and change orientation in landscape this also change orientation of Activity A in landscape why ?

Are you write the the orientation At Manifest like android:screenOrientation="portrait"
or write in your Activity setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Related

Half black screen is visible when device orientation changes from portrait to landscape

I'm using InfiniteCollectionView class, Once I change the device Orientation from portrait to landscape, half the screen looks black for a second
I have also tried the viewWillTransition function by doing the same but I didn't get success

App is confusing between application orientation

I applied SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); to my second page of application when I click on button to go new screen where I set portrait orientation my application firstly show in portrait orientation and change its orientation for 1 second to landscape and after 1 second it set back to portrait. I am calling SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); in build function for each class.
Do not change orientation on different screen. where you need to change the orientation just put your screen into rotated box and rotate it to change orientation by quarterTurns: 2,. Rotatedbox

Programatic iPhone landscape orientation lock

The iPhone has a orientation lock for portrait only. So I added a landscape orientation lock button to my UI that sets a landscape_orientation_locked variable to YES or NO. Then in shouldAutorotateToInterfaceOrientation: I basically do the following:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (landscape_orientation_locked)
return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
return YES;
}
This works fine, except for one case. When I turn the iPhone to landscape orientation, toggle the orientation lock button, rotate the iPhone to portrait orientation and hit the button again. The interface orientation won't change from landscape to portrait. The iPhone has to be turned into landscape and then portrait orientation to trigger the interface rotation.
So my question is: Can I somehow 'force' the iPhone to re-evaluate it's current orientation?
Presenting and then dismissing a mock modal view controller should force an orientation check.
EDIT: Found the question where I first read about that:
Is there a documented way to set the iPhone orientation?

Forcing a UIVIew to lay itself out for the current device orientation

I've been working on this for days and can't crack it. The sequence of events is:
In landscape (let's just say right), the user hits an "edit" button.
A portrait only modal interface slides in. Its shouldAutorotateToInterfaceOrientation returns yes only for portrait.
The device becomes convinced it is in portrait mode.
Problem 1: If the user dismisses the interface without having actually rotated to portrait mode, the device reports that is in landscape right orientation (which it is), but the interface is laid out in portrait orientation.
Problem 2: If the user rotates to portrait, the interface does not get laid out again.
Problem 3: (And this one is weird) Rotating back to the same landscape orientation (right) where the edit button was pressed causes the status bar to return to landscape, but nothing else changes. All my stuff remains laid out in portrait mode. Rotating to the other (left) landscape orientation works perfect.
I need some way to force the layout engine to redo the layout for the orientation the device is actually in.
UIView - layoutSubviews, - setNeedsLayout, and -layoutIfNeeded don't have any effect.
Thanks for any help.
Do what iBooks (2.x) does and force the interface orientation to portrait with
+ (void)attemptRotationToDeviceOrientation. This way, you nip the problem in the bud at step one.

UIDEVICE orientation

hello all i have my splash screen which i want to show in landscape mode and all other screen in potrait mode. My root view controller is acting as a splash screen i am writing this code in viewdidload method
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
But this code is not working and shows me that UIdevice may not respond to setorentation please guide me that how could i change the orentation for only first splash screen and also other screen should be in potrait mode
UIDeviceOrientation refers to the physical orientation of the device whereas UIInterfaceOrientation refers to the orientation of the user interface. You can't change the physical orientation of the device, but you can change how the status bar is displayed via [UIApplication sharedApplication].statusBarOrientation
Can't you just have a splash screen that is displayed sideways?
The user will interpret that as a "landscape" splash and adjust accordingly, whether or not your application actually thinks it is. Just make sure to return NO in shouldAutorotateToInterfaceOrientation: so it doesn't rotate away when the user turns it.
But a warning: it's probably worthwhile to tweak your splash screen so it is in the portrait orientation, since it may be annoying to suggest to the user that your app likes landscape, and then switch to portrait as soon as it actually starts.
If you really want to, though, you can use setStatusBarOrientation:animated: on the UIApplication to force the orientation.