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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:13:25+00:00 2026-06-12T21:13:25+00:00

In my case I have a highly customized iPhone app with all custom views.

  • 0

In my case I have a highly customized iPhone app with all custom views. I’d like to take advantage of the iPhone 5 screen size, but my views require precise layout, and setting the autoresizingMask on my views is not sufficient.

I’d like to end up with some sort of project wide definition flag in each of my source files, and I would need to set this definition/flag at runtime. In my specific case, I could perhaps import some header file definition like this:

if ( IS_IPHONE_5 ) {

/* 
   Set appropriate frames for the additional screen space
*/
}

else {

/* 
  Set views otherwise
*/
}

This question isn’t intended to be entirely subjective–it could apply to anyone looking to set and retrieve project wide definitions. Perhaps another case could be a color theme or something that could be changed in settings.

How do I set these definitions while my program is executing and how do I incorporate them across my source files?

Thank you.

  • 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-12T21:13:26+00:00Added an answer on June 12, 2026 at 9:13 pm

    It could be as simple as putting a macro into your app’s APPNAME_prefix.pch file:

    #define IS_IPHONE_5 ([[UIScreen mainScreen]bounds].size.height == 568)
    

    Every file in your application would be able to use it.

    As an alternative suggestion, I think my preference would be to add a category on UIDevice, and perhaps also add a macro for convenience, and then have only the objects that needed it (i.e. objects in the view and controller layers responsible for layout) import it, to avoid coupling your model to UIKit.

    For example, UIDevice+iPhone5.h:

    #define IS_IPHONE_5 [[UIDevice currentDevice] isIPhone5]
    
    @interace UIDevice (iPhone5)
    
    - (BOOL)isIPhone5;
    
    @end
    

    and UIDevice+iPhone5.m:

    @implementation UIDevice(iPhone5Checking)
    
    - (BOOL)isIPhone5
    {
         return ([[UIScreen mainScreen]bounds].size.height == 568); //or however else you want to check
    }
    
    @end
    

    Whichever best suits your needs. Hope this helps!

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

Sidebar

Related Questions

I have the following case: All boats have a boat type like shark ,
In case I have .NET framework installed in my computer + all the necessary
In my case I have panels,but to make it clear I will use buttons
I have a CSV file which uses a highly customized format. Here, each number
I have a highly customized Edit control which inherits RichTextBox . I needed a
I have simple app that reads acceleremoter values (for x,y and z axis). But
I have a really interesting case: I have a site where this is already
The case: I have 2 tables, 'contracts' and 'members' tied with contract.id = members.cid.
I have a regular .NET application. In this case I have a part that's
I'm new to codeigniter this is my case: I have a homepage with a

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.