分享一個時間消耗計算宏(oc)

    1. #import "ViewController.h"  
    2.   
    3. #define TICK   NSDate *startTime = [NSDate date]  
    4. #define TOCK   NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])  
    5.   
    6. @interface ViewController ()  
    7.   
    8. @end  
    9.   
    10. @implementation ViewController  
    11.   
    12. - (void)viewDidLoad {  
    13.   
    14.     [super viewDidLoad];  
    15.   
    16.     TICK;  
    17.     for (int i = 0; i < 5; i++) {  
    18.         NSLog(@"我的值:%d",i);  
    19.     }  
    20.     TOCK;  
    21. }  
    22.   
    23. @end 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章