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

  • Home
  • SEARCH
  • 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 6348625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:27:25+00:00 2026-05-24T21:27:25+00:00

Is the code below correct? When the user rotates the device, two labels are

  • 0

Is the code below correct? When the user rotates the device, two labels are supposed to go to the coordinates given below. It works when the user starts the app in portrait mode, the labels are placed correctly. However, when the user starts in landscape mode, the labels DO NOT get placed correctly. But if you rotate the view to portrait and then back to landscape, they align properly. I’ve tried placing the landscape coordinates in viewDidLoad, and it still doesn’t work. What should I do? Thanks for your help!

The two labels are recordingTimeLabel and recordingTimeLabelMinutes.

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

 if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
     //is landscape

     backGround.frame = CGRectMake(0, 0, 768, 1024);

     recordingTimeLabel.center = CGPointMake(967, 22);
     recordingTimeLabelMinutes.center = CGPointMake(901, 22);

     NSLog(@"is landscape");

     //  fixedSpace.width = 400;

 } else {
     //is portrait

     backGround.frame = CGRectMake(0, 0, 1024, 768);

     recordingTimeLabel.center = CGPointMake(710, 22);
     recordingTimeLabelMinutes.center = CGPointMake(661, 22);

     NSLog(@"is portrait");

 }



}

Additionally, this code doesn’t work either:

-(void)viewWillAppear:(BOOL)animated {        
if (([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight) || ([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft)) {
    //is landscape

    backGround.frame = CGRectMake(0, 0, 768, 1024);

    recordingTimeLabel.center = CGPointMake(967, 22);
    recordingTimeLabelMinutes.center = CGPointMake(901, 22);

    NSLog(@"is landscape");

} else {
    //is portrait

    backGround.frame = CGRectMake(0, 0, 1024, 768);

    recordingTimeLabel.center = CGPointMake(710, 22);
    recordingTimeLabelMinutes.center = CGPointMake(661, 22);

    NSLog(@"is portrait");

}

}
  • 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-05-24T21:27:27+00:00Added an answer on May 24, 2026 at 9:27 pm

    Got it. I used an NSTimer and called a function very often that contained this code:

    -(void)updateLabelLocation {
    
        if (([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight) || ([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft)) {
    
        recordingTimeLabel.center = CGPointMake(710, 22);
        recordingTimeLabelMinutes.center = CGPointMake(661, 22);
    
        } 
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell how correct the following code below. Iam tryin to create a
Which one below is correct? First code has no quotes in the $_GET array
The code below works. But if I comment out the line Dim objRequest As
The code below is the code i am using. It works fine in thunderbird
is the syntax for the line of code below correct? NSPredicate *predicate = [NSPredicate
How can I correct the problem I keep getting from the code below which
The code below belongs to a binary search algorithm. The user enters numbers in
EDIT: The code below has been edited to show the correct solution to the
I have the code below and it works pretty good except if you enter
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {

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.