常用宏定义
//----時間字符串轉時間戳---
format 示例 ?@"yyyy-MM-dd HH:mm:ss"
#define TIMESTR_TO_C(dateStr,format)\ NSDateFormatter* formatter = [[NSDateFormatter alloc] init];\ [formatter setDateFormat:format];\ NSDate *dateP = [formatter dateFromString:dateStr];\ dateStr = [NSString stringWithFormat:@"%ld", (long)[dateP timeIntervalSince1970]]//----時間戳轉字符串----
#define TIMEC_TO_STR(dateStr,format)\ NSDateFormatter* formatter = [[NSDateFormatter alloc] init];\ [formatter setDateFormat:format];\ NSDate *date = [NSDate dateWithTimeIntervalSince1970:dateStr.longLongValue];\ dateStr = [formatter stringFromDate:date]//獲取設備信息
#define screenHeight [UIScreen mainScreen].bounds.size.height#define screenWidth [UIScreen mainScreen].bounds.size.width#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]//UTF8轉碼
#define UTF8(string) [string stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]//視圖頂部高度
#define DeviceTop (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)?20:0)//加載時判斷項目類型
#ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "AppDelegate.h" #endif//操作系統版本限制
#ifndef __IPHONE_3_0 #warning "This project uses features only available in iOS SDK 3.0 and later." #endif?
轉載于:https://www.cnblogs.com/hushuai-ios/p/3679752.html
總結
- 上一篇: Linux Kernel Makefil
- 下一篇: U-Mail邮件系统客户无需担心Open