orientation

Iphone Orientation and 2 Nib Files

↘锁芯ラ 提交于 2020-01-22 20:00:09
问题 I am trying to make an app where each view controller (.h/.m) has 2 NIB files... one for portrait, one for landscape. Is this the "standard" way of supporting orientation or must I manually set up the orientation view programmatically? The problem I am facing is that when a user flips the orientation, all views are reset (so the user must re-enter text fields/views input). Here is my orientation method: - (void) changeTheViewToPortrait:(BOOL)portrait andDuration:(NSTimeInterval)duration{

UIPopoverController placement

给你一囗甜甜゛ 提交于 2020-01-21 10:28:30
问题 I'm working on an app that is supposed to be universal, one app for both iPad and iPhone. I would like to keep their interfaces as similar as possible. In the iPhone app I am using a Tab bar controller, and one of those tabs goes to an image picker controller. Obviously I cannot do that in iPad. So I have hijacked control of that button to bring a popupcontroller that has the image picker in it. This all works well enough, except when I bring up the popup, it is not in the correct place. When

RecycleView&&Framgment的使用

不问归期 提交于 2020-01-19 04:34:01
一..添加依赖 dependencies { //noinspection GradleCompatible implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' } 二.布局文件 1.layout/activity_main..xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!--<FrameLayout android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/>-->

仿“易企秀”编辑器之拖拉拽

无人久伴 提交于 2020-01-17 10:03:24
概述 最近心血来潮,想仿造一下易企秀,做一个新的编辑器。主要是3年前那个编辑器有些自动化方面和动画性能方面的缺陷吧,人生不能有遗憾就早早动手吧。选择易企秀,而不是互动大师,主要是因为易企秀的技术难度比较低,编辑器的核心部分,如果全职开发,估计一个月就做完了。如果是互动大师,业余时间开发根本估计核心部分都够呛。核心部分包括拖拉拽,组件生命周期,场景增删改,工程增删改,完善的组件事件通信机制,撤销恢复还有动画编辑。 有兴趣的朋友可以进 github 看看。里面有在线演示的地址。该项目还在持续开发中,轻拍,别打脸。 拖拉拽的核心原理 不同的编辑器,不管怎么样,拖拉拽的业务逻辑一定要自己写,这是血的教训。两年前,接手一家公司的编辑器,那个编辑器的核心部分是用某个开源项目的,性能有问题,核心元数据的数据结构也有问题。重构了几次,才契合当时公司的业务。 性能优化 拖拉拽,其实难的是性能处理,尤其是移动端。要是一个场景里面几百个组件,移动端就很痛苦了。 首先必须使用事件委托,因为事件具有冒泡机制,因此我们可以利用冒泡的原理,把事件加到父级上,触发执行效果。这样做的好处当然就是提高性能了。 假如没有使用事件委托,那么100个组件,每个组件1个旋转点,8个缩放点,1个移动点,那么就要添加800个mousedown事件。如果使用事件委托,就只要一个mousedown事件就好。 原理是用户点击页面的时候

Interface Orientation won't change to Landscape on App Launch

风格不统一 提交于 2020-01-17 05:49:05
问题 i stuck on a problem that drives me crazy! I have an iPad application starting with a TabBarViewController. Every Tab has it's own ViewController and nib-file. To make interface orientation possible I added all orientations to my info.plist and subclassing my TabBarController to set: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } Every View is autoresized and formatted well for displaying the right Orientation if I rotate the

Save and restore a ButtonText when screen orientation is switched

穿精又带淫゛_ 提交于 2020-01-16 18:28:26
问题 As usual in android, each time the screen is flipped to portrait/landscape mode an Activity runs through life-cycle from onSaveInstanceState to onDestroy and then is recreated. In my Activity there's a ButtonText which can be changed by the user. It's reseted to the initial state, but I have to save the last state somehow. How can I achieve that, will I have to override onSaveInstanceState? Can someone show an example? 回答1: Step #1: Call getText().toString() on the Button to get the caption.

Save and restore a ButtonText when screen orientation is switched

我的未来我决定 提交于 2020-01-16 18:28:08
问题 As usual in android, each time the screen is flipped to portrait/landscape mode an Activity runs through life-cycle from onSaveInstanceState to onDestroy and then is recreated. In my Activity there's a ButtonText which can be changed by the user. It's reseted to the initial state, but I have to save the last state somehow. How can I achieve that, will I have to override onSaveInstanceState? Can someone show an example? 回答1: Step #1: Call getText().toString() on the Button to get the caption.

Mahony's algorithm - Yaw angle becomes unstable when rotating device fast

寵の児 提交于 2020-01-15 12:23:50
问题 I'm newbie in sensor and IMU so my question is probably very basic for others, but it's already puzzled me for days. I'm using Mahony's algorithm to calculate Euler angle of my device; the three angles looks correct when put the device static or move/rotate the device slowly; however, the Yaw angle will become unstable and incorrect if rotating the device fast. Could someone help me solve this issue ? My device uses MPU-9150, I use the 6 parameters method of Mahony algorithm, that is to say,

Can I get the orientation of a photo taken in my app if I limit the activity's orientation to portrait only in my manifest?

爷,独闯天下 提交于 2020-01-15 08:46:28
问题 I don't want to support landscape UI at all across my app, but I want to be able to automatically rotate the photos users take in landscape mode. Currently if a user takes a photo in landscape mode, it remains on screen as if it was taken in portrait (the horizon in the photo is vertical). I've tried to get the orientation from the system like this: val display = (getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay val screenOrientation = display.rotation Log.d(

Can I get the orientation of a photo taken in my app if I limit the activity's orientation to portrait only in my manifest?

独自空忆成欢 提交于 2020-01-15 08:46:10
问题 I don't want to support landscape UI at all across my app, but I want to be able to automatically rotate the photos users take in landscape mode. Currently if a user takes a photo in landscape mode, it remains on screen as if it was taken in portrait (the horizon in the photo is vertical). I've tried to get the orientation from the system like this: val display = (getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay val screenOrientation = display.rotation Log.d(