orientation

How lock screen in iOS for it to have only portrait orientation?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:08:55
问题 I have created an app with many views and I want to have some of them only in portrait orientation. I have coded this in .m file: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return NO; } Do I need to do something else? May be in .h file? 回答1: Cleanest solution for me: Go to Info.plist file and for the "Supported interface orientations", remove every value except "Portrait (bottom home button)". 回答2: You just need to return a BOOL in that method

how to get a video file's orientation in Python

半世苍凉 提交于 2019-12-10 16:33:45
问题 I would like to load a video file's frames into a numpy array. I want the frames to be properly upright, which means I need to read the orientation metadata in the video file, and rotate the loaded frames accordingly. I have a means of loading the frames (opencv's python bindings), so all I need is a way to read the video file's orientation metadata. I'm trying to read a .MOV file recorded off my iPhone, in python running on an Ubuntu 14.04 machine. Stuff I've looked at: opencv: no way of

WebView not re sizing properly on orientation change

╄→гoц情女王★ 提交于 2019-12-10 15:59:54
问题 I am loading a video url into webview using webview.loadUrl(). The player is encoded in the html itself so I only have to load the url into web view. In case if I dont give android:configChanges="orientation" in my manifest everything works fine. The webview resizes properly on orientation change and the video is adjusted to fit the screen properly, ofcourse then the video restarts. Therefore I gave android:configChanges="orientation" in manifest so that the video doesnt reload. Now although

how to tell if a photo was taken in landscape or portrait? JPEG .NET metadata orientation

家住魔仙堡 提交于 2019-12-10 15:14:26
问题 Thru VB.net/C# is there any way to read any metadata of off a JPEG to tell if the photo was taken in landscape or portrait? I would assume a camera would need an accelerometer first of all to even tell what direction is up...correct? Assuming there is that kind of intelligence to detect the angle of tilt, how would I go about reading that info from a JPEG? I found some samples online to read metadata with vb/.net not sure what to read to find the info i need. Appreciate any pointers..... 回答1:

How to adequatly replace Sensor.TYPE_ORIENTATION (which is now deprecated)?

我怕爱的太早我们不能终老 提交于 2019-12-10 14:55:05
问题 I've tried several code snippets found on the internet in SensorManager.getOrientation() - related discussions. None give magnetic azimuth reliably, as Sensor.TYPE_ORIENTATION did. Could anyone share a working code for Sensor.TYPE_ORIENTATION emulation? 来源: https://stackoverflow.com/questions/15109073/how-to-adequatly-replace-sensor-type-orientation-which-is-now-deprecated

How to check Device Orientation Change From Portrait To Landscape and Vice-Versa in iPad [duplicate]

南笙酒味 提交于 2019-12-10 14:12:18
问题 This question already has answers here : How to detect orientation change? (24 answers) Closed 3 years ago . I have one split view controller and i am presenting a popover inside it. Now when the device orientation is changing from landscape to portrait i have to run a piece of code & if it is changing from portrait to landscape i have to run another piece of code. How to achieve this in Swift. 回答1: From iOS 8.0 You can detect the orientation change using below method. In objective-c - (void

How to retain instance of fragment of fragment playing video after change in orientation?

那年仲夏 提交于 2019-12-10 13:43:46
问题 I have a YouTube API fragment that is statically added in my xml manifest file, i.e. a fragment that has a youtube player inside of it. I do not have a file that extends fragment in my project. In my activity class I put this line of code in the onCreate of my activity class: youTubePlayerFragment.setRetainInstance(true); It does not have any affect: when I rotate the screen I get a blank black screen of the fragment. How can I get it to continue playing the fragment after the orientation

How to avoid re-loading of Admob ads upon configuration change and starting an Activity?

只谈情不闲聊 提交于 2019-12-10 12:59:45
问题 Using the banners sample here, I noticed that if I change the orientation, the ad is gone, and then reloads itself (takes time), so there is a time that nothing is shown, each time I change orientation. I know it's possible to set configChanges for the activity via the manifest (and it actually works), but this is not a recommended thing to do in general. It has multiple flaws: In my case, for example, changing the orientation let the toolbar stay on the same height, which is wrong because it

Xcode not obeying device orientation

帅比萌擦擦* 提交于 2019-12-10 12:59:24
问题 I have set the Device Orientation to have only 'Portrait' checked in Xcode. However when I run my app in the simulator, it rotates in all orientations. My Xcode setting Showing correctly in Portrait (intended) and Landscape (not intended) Anyone faced same issue before? Thanks 回答1: The "General"->"Deployment Info" UI in Xcode can be deceiving. Check these two keys in your info.plist : UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad 回答2: I have had the same problem

android camera setDisplayOrientation(90) fails in different devices

大兔子大兔子 提交于 2019-12-10 12:47:37
问题 I have a problem with my camera app.Camera activity is in portrait mode.So i gave camera.setDisplayOrientation(90); As per different posts in SO, this will work fine in portrait mode. but it never works fine with different devices.The issue is, preview rotated 90 degree left or right.In Htc it's ok. But with galaxy series it's not working. Can anyone help me ? 回答1: I gave this answer to a similar question, but as you say it was on an HTC device. I would recommend that you add breakpoints to