Is it possible to generate an event when the Device is placed on a flat surface?

Discussion in 'iOS Programming' started by fenrus110, Nov 17, 2008.

  1. fenrus110 macrumors regular

    Mar 24, 2008
    Not sure if this is even possible, but my client wants to auto bring up the keyboard and rotate the view to Landscape when the Device is placed on a flat surface.

    From my experiences, rotation events only trigger if the device is perpendicular to the ground.

    Not to mention, how the Device would know if the device is on the palm of a hand or on a table...
  2. chrisesposito macrumors member

    Mar 23, 2008
    Checking the accelerometer values will give you the info you need, although you will probably need to accept a small range of rotation angles that are close enough to level in 2 axes that the surface can be considered "flat" - did you really mean "perpendicular to the gravity vector" when you said "flat'?

  3. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    A human palm rarely stay as motionless as a table. Find a Tai Chi master, have him hold an iPhone as flat as possible for a few seconds. Any less deviation found by the accelerometer in the X and Y axis's over the course of a few seconds, and it's probably a table top.


Share This Page