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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:42:45+00:00 2026-06-15T21:42:45+00:00

I have the following pre-processor code to detect if the device is an iPhone

  • 0

I have the following pre-processor code to detect if the device is an iPhone or iPad, and I want to add iPhone5 to it:

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

#define POS_UI_CHEST  ( (IS_IPAD) ? (ccp(72.0,831.0)) : (ccp(33.0,396.0)) )
#define POS_UI_ROUTE  ( (IS_IPAD) ? (ccp(74.0,521.0)) : (ccp(36.0,240.0)) )
#define POS_UI_GUAGE  ( (IS_IPAD) ? (ccp(384.0,70.0)) : (ccp(160.0,20.0)) )
#define POS_UI_BALL   ( (IS_IPAD) ? (ccp(384.0,70.0)) : (ccp(160.0,20.0)) )

What would be the easiest way to add a 3rd ccp to each conditional?

Thanks!

  • 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-15T21:42:47+00:00Added an answer on June 15, 2026 at 9:42 pm

    You can nest ? : operators as such:

    #define POS_UI_CHEST ( IS_IPAD ? ccp(72.0,831.0) : (IS_IPHONE5 ? ccp(xxx.0,yyy.0) : ccp(33.0,396.0)) )
    

    (I removed the (unnecessary (brackets (for)) ((clarity)) )

    You can find macros for iPhone 5 detection on stackoverflow.

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

Sidebar

Related Questions

I have the following couple of C pre-processor macros for creating test functions: //
The problem I have is illustrated in the following code. #include <iostream> #define X
I have the following code doing Sin/Cos function using a pre-calculated memory table. in
I have the following code in a header file: #ifndef BUFFER_H #define BUFFER_H #include
Suppose I have the following preprocessor definition #define MYNUMBER 10f; I would then like
I have the following: <%= f.select :phase_names, options_for_select([RFP Stage, Pre Contract, Awarded, Unsuccessful, Completed]),
While the C# spec does include a pre-processor and basic directives (#define, #if, etc),
I have the following Python code, and it works perfect with the directed graph.
I have the following ASP code: <asp:LinkButton ID=LinkButton1 runat=server Text=edit item onclick='AddItem.aspx?catid=<%# Eval(CollectionID)%>' />
I just created an Xcode project and wrote the following code: #define foo(x) x

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.