device-orientation

How to support only portrait mode on an iPhone app

我的梦境 提交于 2019-12-23 13:06:41
问题 I have a strange problem in an iPhone app I'm developing. I want my app to support ONLY portrait mode, but for some reason I can't do it (device & simulator). To support only portrait mode I did as follow: In the TARGET summary section on Xcode, I chose only portrait. All my ViewControllers implements shouldAutorotateToInterfaceOrientation But as I said it won't work, and the strange result is that the app support ALL the orientations (portrait, upside down, landscape left, landscape right).

Cordova/Ionic - Set Portrait Only Mode for Mobiles and allow Orientation in Tablets

大城市里の小女人 提交于 2019-12-23 09:32:00
问题 How do we set Mobile phones to Portrait only and allow tablets to switch between portrait and landscape? I am using Ionic/Cordova. Currently I have configured to set the app to be in portrait mode in config.xml using the following property <preference name="orientation" value="portrait" /> 回答1: You could use isTablet plugin in conjunction with screen orientation plugin, something like: .run(function($ionicPlatform) { $ionicPlatform.ready(function() { if(window.isTablet){ screen

keyboard size given by NSNotificationCenter

老子叫甜甜 提交于 2019-12-21 04:37:14
问题 I want to add a accessoryView on a keyboard called from a UISearchBar. Since UISearchBar does not implement this property, I've just created a toolBar. Following Apple's documentation on the matter, I've decided to use notification center not only to know when the keyboard is called but also to know the size of the keyboard, which changes depending on the orientation. I've followed the example on the documentation and, on the keyboardWasShown method, I call an animation which will show the

Javascript doOnOrientationChange :can't fix a bug loading the page

独自空忆成欢 提交于 2019-12-20 04:25:53
问题 I used a .js to avoid landscape view from mobile device. I edited a white full-screen image saying "this site is not thought to be viewed in landscape mode, please turn your device" to be shown each time I rotate my device from portrait to landscape. It works except when I load a page and I'm already in landscape mode. Any idea on how to fix it? Thanks <script> (function() { 'use strict'; var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry:

iOS 6 landscape and portrait orientation

爷,独闯天下 提交于 2019-12-19 03:42:18
问题 I have a table with a big list of stuff that comes from a plist file and clicking each of them takes you to a new view, a xib. I have 2 views inside that .xib, one for portrait and one for landscape In my h file I have this: IBOutlet UIView *portraitView; IBOutlet UIView *landscapeView; @property (nonatomic, retain) IBOutlet UIView *portraitView; @property (nonatomic, retain) IBOutlet UIView *landscapeView; In my m file this: [super viewDidLoad]; // Do any additional setup after loading the

SpriteKit support multiple device orientations

醉酒当歌 提交于 2019-12-19 03:31:20
问题 I have a SpriteKit game which I want to support all orientations. Right now when I change the orientation, the node doesn't keep its position. I use the SKSceneScaleModeResizeFill for scaling, because it will keep the right sprite size. When I start the game, the game player is positioned in the mid screen like this: Then when I rotate the device, the position becomes like this: Here is my view controller code: - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; // Configure the

Rotating a UIAlertView

旧时模样 提交于 2019-12-19 02:27:21
问题 I've created a custom UIAlertView (by subclassing it and messing around with its show function) that has some custom subviews and is of non-standard size. It works ok when I create and display it, however, when the device is rotated, the alert rotates and then returns to its default size. Any ideas what functions to override - or should I tweak the UIViewController? thanks, Peter 回答1: Not sure if force rotating the UIAlertView fits the Apple GUI guidelines, but you can rotate it by defining

Autolayout and Device Orientation

风流意气都作罢 提交于 2019-12-19 02:27:15
问题 I am developing an application which supports portrait and landscape modes . I am using auto layout to arrange my views . As i have been reading many posts and i have realized that developers commonly use one among the following approaches. 1. First approach: Implement the UIViewController:updateConstraints method and update constraints according to device orientation. 2. Second approach: Implement the UIViewController:viewWillLayoutSubviews method and update constraints according to device

Device Orientation API returns different values for desktop browsers

我们两清 提交于 2019-12-18 06:59:38
问题 Using the Device Orientation API demo on desktop Firefox 44 and Chrome Version 47.0.2526.80 m return different results for the coordinates. Firefox returns null and Chrome 0 . So far so good. With this piece of code I am trying to check deviceorientation data. So first I check if the Device Orientation event is supported and both Firefox and Chrome say it is with the first alert firing. if(window.DeviceOrientationEvent) { alert("Device Orientation Event is supported."); window

Flutter: How to set and lock screen orientation on-demand

浪子不回头ぞ 提交于 2019-12-17 21:55:37
问题 On one of my flutter pages, I need the screen to set to landscape mode and lock it so it can't rotate into portrait mode, but only on the one page. So need a way to enable this function on-the-fly. Anyone know how to do this? I would like it to rotate landscape-left or landscape-right, just not into portrait mode. 回答1: First import the services package: import 'package:flutter/services.dart'; This will give you access to the SystemChrome class, which "Controls specific aspects of the