orientation

UIAlertView changes to landscape when App is locked in portrait only in iOS8

时间秒杀一切 提交于 2019-12-19 05:58:21
问题 I have an app and its orientation is locked as portrait mode, but when I have a UIAlertView and turn the iPhone to landscape, the alert changes the orientation and crops the alert's overlay. Only in iOS8. Anyone had this error? 回答1: Yes I did get this issue. I have developed my code in iOS7 but had to do compatible with iOS 8 also. So I came across This link. I got my solution as follows: When you are working with iOS7 UIAlertView works fine but if you are working with iOS8 you have to use

UIWindow's root view controller does not rotate to landscape at app launch

吃可爱长大的小学妹 提交于 2019-12-19 04:58:47
问题 I am developing a xib-based landscape-only app. The app launches in landscape correctly. However, the view in my main ViewController is presented in portrait. That is, it is rotated 90 degrees so that the image appears cropped and does not take up the entire screen. If I use my interface to present a modal view controller then return to the main ViewController, the issue corrects itself (the view is presented in landscape). This problem did not occur under Xcode 4.2. It occurred after

Android 10 shape 的 gradient 不设 angle 角度时默认方向为从上到下的原因

Deadly 提交于 2019-12-18 18:42:29
1 背景 先说明一下问题的背景。 之前项目有个登录按钮,正常时其背景如下图所示,背景颜色为从左到右的渐变色。 背景 xml 也很简单(没有设置 angle): <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FF5D86" android:endColor="#8359FF"/> <corners android:radius="50dp"/> </shape> 在 Android 9 和 9 之前的手机上都没有问题,但是最近发现,跑在 Android 10 的手机上,登录按钮的背景颜色就变成了这样: what,渐变方向变成从上到下了??? 2 Android 10 源码分析 首先需要明确 2 点: 1、 我们在 drawable 目录下新建的标签为 shape 的 XML 文件并非 ShapeDrawable ,而是 GrdientDrawable ; 2、在含有 线性渐变 的 xml 中设置角度 android:angle="0" ,最终会反映到 GrdientDrawable 的内部类变量 mAngle

Properly preventing orientation change in Flex Mobile app

≡放荡痞女 提交于 2019-12-18 17:29:47
问题 Is anyone able to actually make it work properly in Flex SDK 4.6? Here's a short snippet : <?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" addedToStage="onAddedToStage(event)" title="Title"> <fx:Script> <![CDATA[ private function onAddedToStage(event:Event):void { if (stage.autoOrients) { stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChanging, false, 0, true); } } private

How to detect orientation change in layout in Flutter?

China☆狼群 提交于 2019-12-18 14:07:06
问题 How to find out Orientation is portrait or landscape in Flutter if(portrait){ return ListView.builder() }else{ return GridView.count() } 回答1: In order to determine the Orientation of the screen, we can use the OrientationBuilder Widget. The OrientationBuilder will determine the current Orientation and rebuild when the Orientation changes. new OrientationBuilder( builder: (context, orientation) { return new GridView.count( // Create a grid with 2 columns in portrait mode, or 3 columns in //

Android device orientation without geomagnetic

江枫思渺然 提交于 2019-12-18 13:01:44
问题 I need to get device orientation. As I know usually used TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD sensors. My problem is that SensorManager.getDefaultSensor returns me null for geomagnetic sensor. It returns null for TYPE_ORIENTATION sensor too. manager = (SensorManager) getSystemService(SENSOR_SERVICE); Sensor sensorAcc = manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), //normal object sensorMagn = manager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); //null orientationListener = new

Does a child object lose its unique properties after casting back and forth between a parent class

被刻印的时光 ゝ 提交于 2019-12-18 12:56:14
问题 Consider the following classes: public class Phone { private boolean has3g; public boolean has3g() { return has3g; } public void setHas3g(boolean newVal) { has3g = newVal; } } public class Blackberry extends Phone { private boolean hasKeyboard; public boolean hasKeyboard() { return hasKeyboard; } public void setHasKeyboard(boolean newVal) { hasKeyboard = newVal; } } If I was to create an instance of Blackberry , cast it to a Phone object and then cast it back to Blackberry , would the

How to change orientation of a D3 tree layout by 90 degrees

烂漫一生 提交于 2019-12-18 12:07:50
问题 I just started getting involved in web visualizations, so I'm totally novice. My goal is to display a family tree where a root node would have both multiple parents and children. While looking for a solution I found this example: http://bl.ocks.org/jdarling/2503502 It's great because it seems to have the feature I need. However, I would like to alter the orientation (top-to-bottom). I tried to do so using this example: http://bl.ocks.org/mbostock/3184089 but failed. My code: var tree = d3

Retrieve image orientation in PHP

自作多情 提交于 2019-12-18 11:51:23
问题 How can I get the image orientation (landscape or portrait) of an image (JPEG or PNG) in PHP? I created a php site where users can upload pictures. Before I scale them down to a smaller size, I want to know how the image is orientated in order to scale it properly. Thanks for your answer! 回答1: I've always done this: list($width, $height) = getimagesize('image.jpg'); if ($width > $height) { // Landscape } else { // Portrait or Square } 回答2: list($width, $height) = getimagesize("path/to/your

ViewController in UINavigationController orientation change

只谈情不闲聊 提交于 2019-12-18 11:29:48
问题 So I have the following hierarchy: UINavigationController --> RootViewController ( UIViewController ) --> UITableViewController --> DetailViewController ( UIViewController ) I want to lock the orientation on RootViewController to Portrait only, but leave all orientations for the rest view controllers. If I put this to subclassed UINavigationController : - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return