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 7521825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:20:29+00:00 2026-05-30T02:20:29+00:00

up to now I have been using a if and else statement to define

  • 0

up to now I have been using a if and else statement to define the size of objects that are displayed on iPhone or iPad, like for example:

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown){
        //For Portrait on iPhone
        [self.navBar setFrame:CGRectMake(0.0 , 0.0, 320.0f, 44.0)];

    } else if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight){
        //For Landscape on iPhone
        [self.navBar setFrame:CGRectMake(0.0 , 0.0, 480.0f, 44.0)];

    }    
} else {
    if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown){
        //For Portrait on iPad
        [self.navBar setFrame:CGRectMake(0.0 , 0.0, 768.0f, 44.0)];

    } else if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight){
        //For Landscape on iPad
        [self.navBar setFrame:CGRectMake(0.0 , 0.0, 1024.0f, 44.0)];

    }      
}

But now I want to change it in order to make it a bit more dynamic. I am trying to use the following but there is no luck at all.

CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale);

Can anybody please help me on how to implement these two together? It seems that the way I mix them up is the problem. If anybody can give me a template or even a hint for that I will really appreciate it.

Thanks a lot

  • 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-30T02:20:31+00:00Added an answer on May 30, 2026 at 2:20 am

    It seems like you’re overthinking this. Why not just:

    [self.navBar setFrame:CGRectMake(0.0 , 0.0, self.view.frame.size.width, 44.0)];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using Subversion for a few days now and have a question...
Up until now I have been using std::string in my C++ applications for embedded
I have been using SimpleRepository for months now, and for the first time i
I have been using C# for a while now, and going back to C++
I have been using Ruby for a while now and I find, for bigger
I have been using IoC for a little while now and I am curious
I have been using the CSLA framework for couple of years now for windows
I have been using the CodeIgniter system for a while now - but it
I have been using WPF for a few years now and don't have any
I have been using the Infragistics UltraWebGrids for a few years now in multiple

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.