screen-orientation

shouldAutorotateToInterfaceOrientation doesn't work

可紊 提交于 2019-11-26 07:42:01
问题 I\'ve been writing my Universal application in portrait mode, and now after about 15 nib files, many many viewCotnrollers, I\'d like to implement the shouldAutorotateToInterfaceOrientation and design some screens in Landscape mode. adding : - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } to ALL of my viewControllers, does not do the work. During Debug, i see that this method is called, but it just won\'t work! not in the simulator,

Android: Detect Orientation Changed

送分小仙女□ 提交于 2019-11-26 07:39:07
问题 I need to detect an orientation change in my application, but I don\'t want my layout to be changed from portrait to landscape. Currently I\'m using the OrientationEventListener however detecting the orientation angle is not enough. I want to detect that the user changed from portrait to landscape or viceversa, and that is not just detecting if the orientation angle is 90 or 270. I want to do the same detection that the Android does to change the activity\'s orientantion. I tried overriding

PhoneGap - Forcing Landscape orientation

谁都会走 提交于 2019-11-26 04:51:34
问题 I started looking into PhoneGap yesterday and created a simple \"marble\" rolling around while tilting the phone. I am currently developing on Android but I want the orientation to stay as landscaping instead of moving when the phone gets spun around. Is there a way of doing this? Manifest: <?xml version=\"1.0\" encoding=\"utf-8\"?> <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.phonegap.helloworld\" android:versionCode=\"1\" android:versionName=\"1.0\" >

Android: Temporarily disable orientation changes in an Activity

时光毁灭记忆、已成空白 提交于 2019-11-26 03:24:41
问题 My main activity has some code that makes some database changes that should not be interrupted. I\'m doing the heavy lifting in another thread, and using a progress dialog which I set as non-cancellable. However, I noticed that if I rotate my phone it restarts the activity which is REALLY bad for the process that was running, and I get a Force Close. What I want to do is programatically disable screen orientation changes until my process completes, at which time orientation changes are

shouldAutorotateToInterfaceOrientation is not working in iOS 6

*爱你&永不变心* 提交于 2019-11-26 03:10:55
问题 In iOS 6 shouldAutorotateToInterfaceOrientation is not working but it work fine in iOS 5.0 or 5.1 . What should i need to change in iOS 6 . Here is my code - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if([[[SampleApplicationAppDelegate instance].callInfoDictionary valueForKey:IS_CHAT] isEqualToString:NO_RESPONSE]) { int nAngle = 0; BOOL bRet = NO; switch (interfaceOrientation) { case UIInterfaceOrientationPortrait: nAngle = 90; bRet = YES;

How to prevent custom views from losing state across screen orientation changes

我的梦境 提交于 2019-11-26 01:24:57
问题 I\'ve successfully implemented onRetainNonConfigurationInstance() for my main Activity to save and restore certain critical components across screen orientation changes. But it seems, my custom views are being re-created from scratch when the orientation changes. This makes sense, although in my case it\'s inconvenient because the custom view in question is an X/Y plot and the plotted points are stored in the custom view. Is there a crafty way to implement something similar to

Change Screen Orientation programmatically using a Button

99封情书 提交于 2019-11-26 01:08:07
问题 I think this is implementable since screen rotation behaviour can go up to the application level. 回答1: Yes it is implementable! ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); ActivityInfo.SCREEN_ORIENTATION_PORTRAIT setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); ActivityInfo http://developer.android.com/reference/android/content/pm/ActivityInfo.html Refer the link: Button buttonSetPortrait = (Button

Android: Temporarily disable orientation changes in an Activity

送分小仙女□ 提交于 2019-11-26 00:25:24
My main activity has some code that makes some database changes that should not be interrupted. I'm doing the heavy lifting in another thread, and using a progress dialog which I set as non-cancellable. However, I noticed that if I rotate my phone it restarts the activity which is REALLY bad for the process that was running, and I get a Force Close. What I want to do is programatically disable screen orientation changes until my process completes, at which time orientation changes are enabled. Kevin Gaudin As explained by Chris in his self-answer , calling setRequestedOrientation(ActivityInfo

Change Screen Orientation programmatically using a Button

筅森魡賤 提交于 2019-11-25 19:21:21
I think this is implementable since screen rotation behaviour can go up to the application level. Yes it is implementable! ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); ActivityInfo.SCREEN_ORIENTATION_PORTRAIT setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); ActivityInfo http://developer.android.com/reference/android/content/pm/ActivityInfo.html Refer the link: Button buttonSetPortrait = (Button)findViewById(R.id.setPortrait); Button buttonSetLandscape = (Button)findViewById(R.id.setLandscape); buttonSetPortrait