Create a PCH file

Source: Internet
Author: User

PCH can be used to store shared information, such as the width and height of a device's screen. Version number and so on common information

The old version of Xcode automatically creates a PCH file for us, and the new version is not created automatically, if you need to create it yourself manually

Constants can be defined inside after creation is complete

Here is an example of screen size

As follows

------------------------Split Line------------------------split line------------------------split line------------------------Split Line------------- -----------Split Line------------------------Split Line------------------------

The code is as follows:

Get screen width, height

#define SCREEN_FRAME ([UIScreen mainscreen].applicationframe)

#define SCREEN_WIDTH ([UIScreen mainscreen].bounds.size.width)

#define Screen_height ([UIScreen mainscreen].bounds.size.height)

Finally need to make a configuration

Then you can use it directly in your program.

CGRectMake (0,60,screen_width, screen_height-60)

Create a PCH file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.