使用pch先行編譯檔案,

來源:互聯網
上載者:User

使用pch先行編譯檔案,

首先建立一個pch檔案,然後要修改這個項目的Build Setting中的Prefix Header   修改為 $(SRCROOT)/項目名稱/先行編譯檔案名稱;

一般pch檔案的用處:

1、匯入架構,如:

   #import <Foundation/Foundation.h>

   #import <UIKit/UIKit.h>  等等

2、宏定義

   #define KSCREENWIDTH    [UIScreen mainScreen].bounds.size.width    //螢幕的寬
   #define KSCREENHEIGHT   [UIScreen mainScreen].bounds.size.height  //螢幕的高

   //介面資料     方便程式的外包  修改此檔案方便
   #define              US_BOX                 @"us_box"                 //首頁資料介面
   #define              NEWS_LIST              @"news_list"              //新聞介面     //設定是否偵錯模式 #define DEBUG   1  //登出後就不會列印   #ifdef DEBUG
   #define NSLog( s, ... ) NSLog( @"%@", [NSString stringWithFormat:(s), ##__VA_ARGS__] )
   #else
   #define NSLog( s, ... )   #endif    //宏定義一個函數  建立隨機顏色
   #define    RGB(a)    [UIColor colorWithRed:arc4random()%10*.1 green:arc4random()%10*.1 blue:arc4random()%10*.1 alpha:a]
    //裝置型號的判斷
   #define   DEVICENUM    [[UIDevice currentDevice].systemVersion floatValue]

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.