UI Basics-Introduction to project Files

Source: Internet
Author: User

Introduction to project documents
    • Create a new project with 3 folders on the left
      • The 1th folder contains all the code files and data files related to the project.
      • Supportingfiles contains configuration files and other data files
      • The final ui-tests folder is mainly used for unit testing, we do not use it at this time, so we do not consider it first.
    • Info.plist files, configuration information files for projects
    • PCH file, a header file for all common classes or macros in a project
info.plist File
    • A file with a name of "project name-info.plist" was created for the project before Xcode6, and it was info.plist file after Xcode6.
    • This file is primarily used to save basic configuration information for the current project
      • The contents of the Info.plist file are actually in XML format and can be seen through "right-click", "Open as SourceCode".
      • Saved information, such as the application version number, applies the minimum system version number that is required to run.
      • Application startup to load the storyboard file name
    • Common key:
      • Bundle display Name the key of the application name, if it is too long, it cannot be fully displayed.
      • The only indication of the bundle identifier application, if identical, will be overwritten.
      • Bundle versions String short the version number at the end of the application release
      • Bundle version is for an internal version number.
      • Supported interface Ortations identifies the direction supported by the device, corresponding to the "project", "General", "Deployment Info", "Device Orientation". iphone only supports 3 kinds of directions, does not support upside-down rotation, Portrait (vertical screen), Landscape left (horizontal screen to the left), Landscape right (Landscape)
Note: Do not include the Info keyword in the plist file that you created. PCH file
  • Full Name "Prefix header file (prefix header)", Precompiled header file.
  • Apple is not recommended for use after Xcode 6.

    • encountered problems:
      • The header file for a class is used in many places throughout the project
      • the same macro
      • is used in many places throughout the project NSL OG () method, want to clear out all of a sudden
    • to solve the above problems, you can use the PCH file, it is also a header file similar to the *.h file Note: The PCH file features, all other code files in the project are displayed in unordered import of the PCH file, Access is available by default (other files can be used manually #import the PCH file)
  • Main role:

    • can do some common macro definitions
    • writes the #import import of the public model class to the PCH file.
    • custom NSLog (). Example: #define HQLOG (...) NSLog ( Va_args )
    • create pch file
      • newFile, "", ""
      • put the generic header file and the corresponding macro in.
    • Configuration header file to use header file

      • Select Project, Build Setting, all, search for "Prefix header" , configure the appropriate PCH file.
      • "$ (srcroot)/$ (product_name)/prefixheader.pch" (if there is a problem, change to the following way, may be related to Chinese)
      • "$ (srcroot)/corresponding folder name/ Prefixheader.pch "
    • A lot of log information is required when testing the application, but it is forbidden to print the information if we publish the program.

      • Customize your own log mode.
      • Custom log complete form
        #ifdef debug #define HQLOG (...) NSLog (__va_args__)  #else  #define HQLOG (...)
        #endif       
  • Points to note when using PCH files:

    • Create a C language file, directly compile the error, because by default all files will contain the OC content in the PCH file, the C language file does not recognize the OC code, so it will be an error.
    • Resolution: In the PCH file, if it is the OC file to introduce a response macro, if it is a normal C language file is not introduced, otherwise the project will add the C language file error.

      #ifdef __OBJC__// OC相关的内容#endif

UI Basics-Introduction to project Files

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.