How to use the. pch file in iOS

Source: Internet
Author: User

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

The old version of Xcode will create the PCH file for us on its own initiative, and the new version number is not created on its own initiative. Suppose you need to use the ability to manually create


Can define constants in the inside after creation

Here is an example of screen size

For example, the following


------------------------Cutting line------------------------cutting line------------------------cutting line------------------------cutting line------------- -----------Cutting line------------------------cutting 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 do a configuration


And then use it in the program to directly use the


CGRectMake (0,screen_width, screen_height- )



How to use the. pch file in iOS

Related Article

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.