"Prefix.pch"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 5개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==기본값==
==기본값==
<source lang='objc'>
<syntaxhighlight lang='objc'>
//
//
// Prefix header for all source files of the '프로젝트명' target in the '프로젝트명' project
// Prefix header for all source files of the '프로젝트명' target in the '프로젝트명' project
15번째 줄: 15번째 줄:
     #import <Foundation/Foundation.h>
     #import <Foundation/Foundation.h>
#endif
#endif
</source>
</syntaxhighlight>


==추가==
==추가==
<source lang='objc'>
<syntaxhighlight lang='objc'>
// 변수 할당 축약형
// 변수 할당 축약형
#define DIC1(obj1,key1) [NSDictionary dictionaryWithObjectsAndKeys:obj1,key1,nil]
#define DIC1(obj1,key1) [NSDictionary dictionaryWithObjectsAndKeys:obj1,key1,nil]
#define DIC2(obj1,key1,obj2,key2) [NSDictionary dictionaryWithObjectsAndKeys:obj1,key1,obj2,key2,nil]
#define DIC2(obj1,key1,obj2,key2) [NSDictionary dictionaryWithObjectsAndKeys:obj1,key1,obj2,key2,nil]


#define IMG(x) [UIImage imageNamed:x]
#define IMG(x) [UIImage imageNamed:x]


#define MP3(x) [[NSBundle mainBundle] pathForResource:x ofType:@"mp3"]
#define MP3(x) [[NSBundle mainBundle] pathForResource:x ofType:@"mp3"]
33번째 줄: 33번째 줄:
#define INT2NUM(x) [NSNumber numberWithInt:(x)]
#define INT2NUM(x) [NSNumber numberWithInt:(x)]
#define FLT2NUM(x) [NSNumber numberWithFloat:(x)]
#define FLT2NUM(x) [NSNumber numberWithFloat:(x)]
 
#define STR2DAT(x) [x dataUsingEncoding: NSUTF8StringEncoding]
// 배열
// 배열
#define ArrayLength(x) (sizeof(x)/sizeof((x)))
#define ArrayLength(x) (sizeof(x)/sizeof((x)))


// 그래픽
// 그래픽
42번째 줄: 42번째 줄:
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
</source>
 
// 사용자 정의 변수
#define UDInt(x) [[NSUserDefaults standardUserDefaults] integerForKey:x]
#define UDBool(x) [[NSUserDefaults standardUserDefaults] boolForKey:x]
#define UDFloat(x) [[NSUserDefaults standardUserDefaults] floatForKey:x]
#define UDDouble(x) [[NSUserDefaults standardUserDefaults] doubleForKey:x]
 
#define UDSetInt(x,y) [[NSUserDefaults standardUserDefaults] setInteger:x forKey:y]
#define UDSetBool(x,y) [[NSUserDefaults standardUserDefaults] setBool:x forKey:y];
#define UDSetFloat(x,y) [[NSUserDefaults standardUserDefaults] setFloat:x forKey:y]
#define UDSetDouble(x,y) [[NSUserDefaults standardUserDefaults] setDouble:x forKey:y]
#define UDSync() [[NSUserDefaults standardUserDefaults] synchronize]
 
//NOTIFICATION
#define NotiAdd(x) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onNoti:) name:x object:nil]
#define NotiCall(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:self userInfo:obj]
 
//SQL
#define SQLCountQuery(x) [SQL countQuery:x]
#define SQLCountQuery1(x,a) [SQL countQuery:[NSString stringWithFormat:x,a]]
#define SQLCountQuery2(x,a,b) [SQL countQuery:[NSString stringWithFormat:x,a,b]]
#define SQLCountQuery3(x,a,b,c) [SQL countQuery:[NSString stringWithFormat:x,a,b,c]]
#define SQLCountQuery4(x,a,b,c,d) [SQL countQuery:[NSString stringWithFormat:x,a,b,c,d]]
#define SQLCountQuery5(x,a,b,c,d,e) [SQL countQuery:[NSString stringWithFormat:x,a,b,c,d,e]]
 
#define SQLQuery(x) [SQL query:x]
#define SQLQuery1(x,a) [SQL query:[NSString stringWithFormat:x,a]]
#define SQLQuery2(x,a,b) [SQL query:[NSString stringWithFormat:x,a,b]]
#define SQLQuery3(x,a,b,c) [SQL query:[NSString stringWithFormat:x,a,b,c]]
#define SQLQuery4(x,a,b,c,d) [SQL query:[NSString stringWithFormat:x,a,b,c,d]]
#define SQLQuery5(x,a,b,c,d,e) [SQL query:[NSString stringWithFormat:x,a,b,c,d,e]]
#define SQLQuery6(x,a,b,c,d,e,f) [SQL query:[NSString stringWithFormat:x,a,b,c,d,e,f]]
 
//equivalent funciton for PHP
#define explode(delimiter,string) [string componentsSeparatedByString:delimiter]
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:55 기준 최신판

1 기본값[ | ]

//
// Prefix header for all source files of the '프로젝트명' target in the '프로젝트명' project
//

#import <Availability.h>

#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif

2 추가[ | ]

// 변수 할당 축약형
#define DIC1(obj1,key1)	[NSDictionary dictionaryWithObjectsAndKeys:obj1,key1,nil]
#define DIC2(obj1,key1,obj2,key2)	[NSDictionary dictionaryWithObjectsAndKeys:obj1,key1,obj2,key2,nil]

#define IMG(x)	[UIImage imageNamed:x]

#define MP3(x)	[[NSBundle mainBundle] pathForResource:x ofType:@"mp3"]
#define WAV(x)	[[NSBundle mainBundle] pathForResource:x ofType:@"wav"]
#define PNG(x)	[[NSBundle mainBundle] pathForResource:x ofType:@"png"]
#define JPG(x)	[[NSBundle mainBundle] pathForResource:x ofType:@"jpg"]

// 형변환
#define INT2NUM(x)	[NSNumber numberWithInt:(x)]
#define FLT2NUM(x)	[NSNumber numberWithFloat:(x)]
#define STR2DAT(x)	[x dataUsingEncoding: NSUTF8StringEncoding]
// 배열
#define ArrayLength(x)	(sizeof(x)/sizeof((x)))

// 그래픽
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

// 사용자 정의 변수
#define UDInt(x)	[[NSUserDefaults standardUserDefaults] integerForKey:x]
#define UDBool(x)	[[NSUserDefaults standardUserDefaults] boolForKey:x]
#define UDFloat(x)	[[NSUserDefaults standardUserDefaults] floatForKey:x]
#define UDDouble(x)	[[NSUserDefaults standardUserDefaults] doubleForKey:x]

#define UDSetInt(x,y)	[[NSUserDefaults standardUserDefaults] setInteger:x forKey:y]
#define UDSetBool(x,y)	[[NSUserDefaults standardUserDefaults] setBool:x forKey:y];
#define UDSetFloat(x,y)	[[NSUserDefaults standardUserDefaults] setFloat:x forKey:y]
#define UDSetDouble(x,y)	[[NSUserDefaults standardUserDefaults] setDouble:x forKey:y]
#define UDSync()	[[NSUserDefaults standardUserDefaults] synchronize]

//NOTIFICATION
#define NotiAdd(x)	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onNoti:) name:x object:nil]
#define NotiCall(name,obj)	[[NSNotificationCenter defaultCenter] postNotificationName:name object:self userInfo:obj]

//SQL
#define SQLCountQuery(x)	[SQL countQuery:x]
#define SQLCountQuery1(x,a)	[SQL countQuery:[NSString stringWithFormat:x,a]]
#define SQLCountQuery2(x,a,b)	[SQL countQuery:[NSString stringWithFormat:x,a,b]]
#define SQLCountQuery3(x,a,b,c)	[SQL countQuery:[NSString stringWithFormat:x,a,b,c]]
#define SQLCountQuery4(x,a,b,c,d)	[SQL countQuery:[NSString stringWithFormat:x,a,b,c,d]]
#define SQLCountQuery5(x,a,b,c,d,e)	[SQL countQuery:[NSString stringWithFormat:x,a,b,c,d,e]]

#define SQLQuery(x)	[SQL query:x]
#define SQLQuery1(x,a)	[SQL query:[NSString stringWithFormat:x,a]]
#define SQLQuery2(x,a,b)	[SQL query:[NSString stringWithFormat:x,a,b]]
#define SQLQuery3(x,a,b,c)	[SQL query:[NSString stringWithFormat:x,a,b,c]]
#define SQLQuery4(x,a,b,c,d)	[SQL query:[NSString stringWithFormat:x,a,b,c,d]]
#define SQLQuery5(x,a,b,c,d,e)	[SQL query:[NSString stringWithFormat:x,a,b,c,d,e]]
#define SQLQuery6(x,a,b,c,d,e,f)	[SQL query:[NSString stringWithFormat:x,a,b,c,d,e,f]]

//equivalent funciton for PHP
#define explode(delimiter,string)	[string componentsSeparatedByString:delimiter]

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}