Detect vertical or horizontal position iOS - ios

I have an iPhone 4 and I would like to detect whether the phone is vertically straight (see first image) or horizontal (see second image). I am not talking about portrait vs landscape view detection.
I am new to iOS development and I think what I am looking for is the accelerometer (specifically the pitch property perhaps) or gyroscope. I have looked online and I am not quite understanding the code or whether I am looking for the right properties. Can someone please tell me how this can be done?
Thank you!

Try the accelerometer api and check the position of the phone.
here is a tutorial: http://tech.pro/tutorial/968/iphone-tutorial-reading-the-accelerometer

Related

Google Vision iOS Example: Scanned barcode Shape(purpleColor) shows in wrong location

I have downloaded the google vision api from https://github.com/googlesamples/ios-vision. And I tried Barcode detector example, When I try to scan a linear and 2D barcodes, the scanned area(purple shape) shows in wrong location on preview layer.
Note: This issue only occurs when I hold the device horizontally at the top of barcode.
Herewith I have attached the screenshot which reflects this issue.
Thank you!
We might need more details about how the framework you mentioned handles orientations. But 2 possible solutions I can think of are:
1) If your project only supports portrait mode, clearly specify it in the project settings. This often solves the orientation issues. (I had a similar one when using OpenCV's camera implementation)
2) If your project does support different orientations, you might have to handle orientations yourself for that specific view controller, something like this:
What is the "right" way to handle orientation changes in iOS 8?

How to duplicating perspective zoom home screen feature in iOS?

As we all know, iOS 8 having a perspective zoom feature in the home screen which zooms depend on the angle of a device and how it moves.
I want to duplicate that feature inside my app. I found a question to find out the angle of a device here.
How can I determine the angle of the device?
Measuring tilt angle with CMMotionManager
I need to discuss the ideas to zoom the image depend on the angle of a device. Any help would be appreciated.
Edit: It is a duplicate of this question: iOS 7 parallax effect in my view controller
Thanks for you help.
That feature is called a 'parallax effect' and there is built-in support in Cocoa Touch for it. You don't need to re-invent the wheel to add that effect to your apps. Search the web for information on UIInterpolatingMotionEffect. Here, in particular, is Apple's brief documentation on it.

DeepEnd(cydia tweak) like 3D background for iOS

I am trying to emulate 3D background in one of the application we are developing.
Check this video on what i am trying to do : http://www.youtube.com/watch?v=429kM-yXGz8
Here is what i am trying to do to emulate this 3D illusion in our
application for iPad.
I have a RootView with 3 rounded buttons centered on the screen which animates in circular motion.
On bottom screen i have some banners of size (600*200) which keeps rotating with flip animation.
I also have some graphical text that is part of the background which contains the "Welcome message"
All elements are individual graphics, and hence when the user moves the iPad we only move the background based on the position of iPad using x,y,z coordinates of accelerometer.
the background moves accordingly, however this is not enough to have 3D illusion, so we decided to add some shadows to graphical elements(buttons, banners, text) and move the shadow accordingly with the iPad's position.
However the result is not convincing, and accelerometer is not updating value if user moves iPad to left and right on stand up position facing iPad straight to the head.
I was wondering if anyone have tried to achieve something similar with success? or any resource to help on how to achieve this? i am just confused whether by using only accelerometer will work or should i go with gyroscope?
Using face detection for simulating a 3D effect already has been done (by me). You can download a complete sample from http://evict.nl/code/face-tracking See the video on that page for a quick demo.
You should definitely use both. accelerometer (movement) and gyroscope (device angle). But for a true 3d effect you probably need to use the camera + face detection.

3D Cube scrolling on hover, working on tablets

The only thing I want to know is if this is possible,
I want an 3d cube that scrolls(horizontally) if you move with your finger at the tablet screen. I want to use HTML5 + CSS3 For this, I am just not sure if this is possible.
Needs to work on iPads, iPhones, Galaxy tabs, etcetra.
I apprentice ur help if you you any more about this.
Since you're asking whether if this is possible or not, the answer is yes, it can be done.
Here's a demo that can at least point you to the right direction : http://www.paulrhayes.com/experiments/cube-3d/touch.html

iPad Object Detection

I want to build an iPad app that detect an alphabet physical shape placed on the iPad screen and print the alphabet to the screen after processing the object detection. Is this doable?
I am trying to find a way to implement this, but could not find any article or online resource that guide me to that.
Thanks,
I would imagine you could start by looking at the various pens and stylus's that are available for iPads. Look at how they work. Then you would need to see if you cna make an object that will activate the touch mechanism over a defined area in the same way, for example - a line, and see if you can detech the touch points along the line. Sorting all that out will effectively get you started.

Resources