IOS Orientation Change

Share this

I recently had to find and use the orientation on an IOS project so i used [[UIDevice currentDevice] orientation]. This worked most of the time but I noticed there were times that it did not detect the orientation correctly.

Sometimes it would return zero when the actual device was in landscape. After some searches and a few tests I found out that it only happened when the app was started in landscape mode and never rotated before the orientation was read.

So, it would seem that until the first rotation that orientation will always be zero. From the tests I found that using [UIApplication sharedApplication].statusBarOrientation is much more accurate.

Use

    [UIApplication sharedApplication].statusBarOrientation

to find the orienation of an IOS device.

Excellent blog hеre! Αlso

Excellent blog hеre! Αlso your website loads up fast!
What hоst are you using? Can I gеt your аffiliatе link to
your host? I wish my site loadеd up аs fast as yours lol

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <drupal5>, <drupal6>, <html4strict>, <java>, <javascript>, <objc>, <php>, <python>, <ruby>, <tsql>.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.