Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9103337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:36:39+00:00 2026-06-17T01:36:39+00:00

I have an app where I am making my iOS device make a sound

  • 0

I have an app where I am making my iOS device make a sound when the user changes the device’s position. I have the user put the device in a flat position, landscape position, and then portrait position, and when the user puts the device in those positions at the appropriate time, the app emits a sound to confirm the position.

My problem however is that if the device is initially in the flat position (e.g. lying flat on a desk), the device does NOT make a sound. In other words, the sound is only emitted when the user PUTS the device in that position and does not immediately sense the position that it is in already. Is there a way for me to rectify this such that the app emits a sound if it is either initially in that position or is put into the correct position? Here is my relevant code:

- (void) orientationCheck {

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(orientationChanged:)
                                                 name:UIDeviceOrientationDidChangeNotification
                                               object:[UIDevice currentDevice]];

    timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(showTextOnly) userInfo:nil repeats:NO];
}


- (void) orientationChanged:(NSNotification *)note
{
    UIDevice *device = note.object;

    if(currentTest == flatTest) {

        testLabel.frame = CGRectMake(50, 30, 200, 150);
        [testLabel setText:@"Hold device on its side."];
        testImage.frame = CGRectMake(10, 150, 300, 200);
        testImage.image = [UIImage imageNamed:@"accelerometer test - side.png"];

        if (device.orientation == UIDeviceOrientationFaceUp || device.orientation == UIDeviceOrientationFaceDown) {

           ...

        }

    }

Can anyone see what I am doing wrong, and how I can fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:36:40+00:00Added an answer on June 17, 2026 at 1:36 am

    Why don’t you just check the device’s orientation at launch time? In other words, besides registering for the notification when the device orientation changes, look to see what the device orientation is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a drawing app for iOS and I have the following classes:
I am making a mobile iOS app. A user can create an account, and
I'm making an iOS app which is OpenFeint enabled. I have managed to get
We are making MFi hardware and an iOS app. We will want to have
I have a unit test called TestMakeAValidCall() . It tests my phone app making
I have a web app I'm making to run off a CMS that is
I'm making a painting app, and I currently have the app at a point
I have been reading The Business of iPhone and iPad App Development: Making and
i have a question regarding an gallery/picture tag app im making for a course.
I'm making an app where I have different things: images, videos,a viewController(.h and .m)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.