========================================= 국가 설정 값 =====================================

NSLocale *locale = [NSLocale currentLocale];
NSString* conCode = [locale objectForKey:NSLocaleCountryCode];
NSString* conName = [locale displayNameForKey:NSLocaleCountryCode value:conCode];

국가 리전 코드 값은
http://lifehack.kr/90095666575

참고 하시면 됩니다.!!!! 뒤에 큰 대문자들입니다 ^^

========================================== 언어 설정 값 =====================================

NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
NSString* currentLanguage = [languages objectAtIndex:0];

입니다 ^^

예를 들자면..

if([currentLanguage usEqualToString:@"ko"])
{
     ******
}
else
{
   ********
}

이런씩으로 하면 되겠네요 ^^

http://www.cocos2d-iphone.org/forum/topic/8424
http://www.admob.com
애드몹을 사용 하시기 위해서는 위의 사이트에서 등록 하여 고유 넘버 키를 받으셔야 사용이가능 합니다.
참고 사이트 입니다.


=============================================================================
AdViewController.h
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
#import "AdMobDelegateProtocol.h"

@protocol AdViewControllerDelegate;

@interface AdViewController : UIViewController <ADBannerViewDelegate, AdMobDelegate>
{
	id <AdViewControllerDelegate> delegate;
	id adBannerView;

	AdMobView* adMobAd;
}

@property (nonatomic, assign) id <AdViewControllerDelegate> delegate;

- (id)initWithMasterView:(UIView*)masterView;
- (void)rotateBannerView:(UIDeviceOrientation)toDeviceOrientation;

@end

@protocol AdViewControllerDelegate

- (void)adController:(AdViewController*)controller didLoadiAd:(id)iadBanner;
- (void)adController:(AdViewController*)controller didFailedToRecieveiAd:(id)iadBanner;

- (void)adController:(AdViewController*)controller didLoadAdMobAd:(AdMobView*)adMobBanner;
- (void)adController:(AdViewController*)controller didFailedToRecieveAdMobAd:(AdMobView*)adMobBanner;

@end

AdViewController.m

#import "AdViewController.h"
#import "cocos2d.h"

#import "AdMobView.h"

@implementation AdViewController

@synthesize delegate;

- (UIDeviceOrientation)currentOrientation
{
	return [[CCDirector sharedDirector] deviceOrientation];
}

- (id) initWithMasterView:(UIView*) masterView
{
	if( nil != (self = [super init]) )
	{
		[self setView:masterView];

		//Initialize the class manually to make it compatible with iOS < 4.0
		Class classAdBannerView = NSClassFromString(@"ADBannerView");
		if (classAdBannerView != nil)
		{
			adBannerView = [[classAdBannerView alloc] initWithFrame:CGRectZero];
			[adBannerView setDelegate:self];
			[adBannerView setRequiredContentSizeIdentifiers: [NSSet setWithObjects:
															  ADBannerContentSizeIdentifier320x50,
															  ADBannerContentSizeIdentifier480x32, nil]];

			[self.view addSubview:adBannerView];

			[self rotateBannerView:[self currentOrientation]];

			[adBannerView setHidden:YES];

		}
		else
		{
			//Request an AdMob Ad
			adMobAd = [AdMobView requestAdOfSize:ADMOB_SIZE_320x48 withDelegate:self];
			[adMobAd retain];
		}
	}

	return self;
}

- (void)rotateBannerView:(UIDeviceOrientation)toDeviceOrientation
{
	if (adBannerView)
	{
		if (UIDeviceOrientationIsLandscape(toDeviceOrientation))
			[adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifier480x32];
		else
			[adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifier320x50];

		[(UIView*)adBannerView setTransform:CGAffineTransformIdentity];

		//Set the transformation for each orientation
		switch (toDeviceOrientation)
		{
			case UIDeviceOrientationPortrait:
			{
				[(UIView*)adBannerView setCenter:CGPointMake(160, 455)];
			}
				break;
			case UIDeviceOrientationPortraitUpsideDown:
			{
				[(UIView*)adBannerView setTransform:CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(180))];
				[adBannerView setCenter:CGPointMake(160, 25)];
			}
				break;
			case UIDeviceOrientationLandscapeLeft:
			{
				[(UIView*)adBannerView setTransform:CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(90))];
				[adBannerView setCenter:CGPointMake(16, 240)];
			}
				break;
			case UIDeviceOrientationLandscapeRight:
			{
				[(UIView*)adBannerView setTransform:CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(-90))];
				[adBannerView setCenter:CGPointMake(304, 240)];
			}
				break;
			default:
				break;
		}
	}

	if (adMobAd)
	{
		[adMobAd setTransform:CGAffineTransformIdentity];

		//Set the transformation for each orientation
		switch (toDeviceOrientation)
		{
			case UIDeviceOrientationPortrait:
			{
				[adMobAd setCenter:CGPointMake(160, 456)];
			}
				break;
			case UIDeviceOrientationPortraitUpsideDown:
			{
				[adMobAd setTransform:CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(180))];
				[adMobAd setCenter:CGPointMake(160, 24)];
			}
				break;
			case UIDeviceOrientationLandscapeLeft:
			{
				[adMobAd setTransform:CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(90))];
				[adMobAd setCenter:CGPointMake(24, 240)];
			}
				break;
			case UIDeviceOrientationLandscapeRight:
			{
				[adMobAd setTransform:CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(-90))];
				[adMobAd setCenter:CGPointMake(296, 240)];
			}
				break;
			default:
				break;
		}
	}
}

#pragma mark -
#pragma mark ADBannerViewDelegate

- (BOOL)allowActionToRun
{
	return YES;
}

- (void) stopActionsForAd
{
	//Pause background music here

	[adBannerView setHidden:YES];

	[[CCDirector sharedDirector] stopAnimation];
	[[CCDirector sharedDirector] pause];
}

- (void) startActionsForAd
{
	//Resume background music here

	[self rotateBannerView:[self currentOrientation]];
	[[UIApplication sharedApplication] setStatusBarOrientation:(UIInterfaceOrientation)[self currentOrientation]];
	[adBannerView setHidden:NO];

	[[CCDirector sharedDirector] stopAnimation];
	[[CCDirector sharedDirector] resume];
	[[CCDirector sharedDirector] startAnimation];
}

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
	BOOL shouldExecuteAction = [self allowActionToRun];
    if (!willLeave && shouldExecuteAction)
    {
		[self stopActionsForAd];
    }
    return shouldExecuteAction;
}

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
	[adBannerView setHidden:NO];
	[delegate adController:self didLoadiAd:banner];
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
	[adBannerView setHidden:YES];
	[delegate adController:self didFailedToRecieveiAd:banner];
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
	[self startActionsForAd];
}

#pragma mark -
#pragma mark AdMobDelegate methods

- (NSString *)publisherIdForAd:(AdMobView *)adView
{
	return @"your_admob_publisher_id";    //replace it with you publisher id
}

- (UIViewController *)currentViewControllerForAd:(AdMobView *)adView {
	return self;
}

- (UIColor *)adBackgroundColorForAd:(AdMobView *)adView
{
	return [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; // this should be prefilled; if not, provide a UIColor
}

- (UIColor *)primaryTextColorForAd:(AdMobView *)adView
{
	return [UIColor colorWithRed:1 green:1 blue:1 alpha:1]; // this should be prefilled; if not, provide a UIColor
}

- (UIColor *)secondaryTextColorForAd:(AdMobView *)adView
{
	return [UIColor colorWithRed:1 green:1 blue:1 alpha:1]; // this should be prefilled; if not, provide a UIColor
}

- (NSArray *)testDevices
{
	return [NSArray arrayWithObjects: ADMOB_SIMULATOR_ID, nil];
}

- (void)didReceiveAd:(AdMobView *)adView
{
	CCLOG(@"AdMob: Did receive ad");

	[self rotateBannerView:[self currentOrientation]];
	[self.view addSubview:adMobAd];

	[delegate adController:self didLoadAdMobAd:adView];
}

// Sent when an ad request failed to load an ad
- (void)didFailToReceiveAd:(AdMobView *)adView
{
	CCLOG(@"AdMob: Did fail to receive ad");
	[adMobAd removeFromSuperview];
	[adMobAd release];
	adMobAd = nil;

	[delegate adController:self didFailedToRecieveAdMobAd:adView];
}

#pragma mark -
#pragma mark Memory Management

- (void) dealloc
{
	if (adMobAd)
	{
		[adMobAd setDelegate:nil];
		[adMobAd removeFromSuperview];
		[adMobAd release];
		adMobAd = nil;
	}

	if (adBannerView)
	{
		[adBannerView setDelegate:nil];
		[adBannerView removeFromSuperview];
		[adBannerView release];
		adBannerView = nil;
	}

    [super dealloc];
}

@end

The usage is very simple, #import AdViewController.h in you Layer's .h and add the delegate protocol AdViewControllerDelegate

#import "AdViewController.h"

@interface Menu : CCLayer <AdViewControllerDelegate>
{
	AdViewController	*adController;
}

And in your layer's .m add this

- (void)onEnter
{
	[super onEnter];

	adController = [[AdViewController alloc] initWithMasterView:[[CCDirector sharedDirector] openGLView]];
	[adController setDelegate:self];

}

- (void)onExit
{
	//Completely remove the controller
	[adController setDelegate:nil];
	[adController release];
	adController = nil;

	[super onExit];
}

- (void)adController:(AdViewController*)controller didLoadiAd:(id)iadBanner;
{
	//Do something when the ad loads, like moving objects.
}

- (void)adController:(AdViewController*)controller didFailedToRecieveiAd:(id)iadBanner;
{
	//Do something when the ad fails to load, like moving objects.;
}

- (void)adController:(AdViewController*)controller didLoadAdMobAd:(AdMobView*)adMobBanner;
{
	//Do something when the ad loads, like moving objects.
}

- (void)adController:(AdViewController*)controller didFailedToRecieveAdMobAd:(AdMobView*)adMobBanner;
{
	//Do something when the ad fails to load, like moving objects.
}
훌 이분 용자인듯 0.0
먼저 iAd.framework 를 추가 하는 부분은 인터넷에서 많이 찾아 볼수 있는 정보 이니 생략 하겠습니다.

2주 전만 해도 정보가 많이 부족 했는데 최근 들어서 iAd관련 하여 정보가 많이 올라 오고 있는것으로 보입니다.

아직까지 미국에서만 된다니 한국에서는 테스트 조차도 못해보는 ㅠㅠ

일반 게임을 만들시에 많은 분들이 cocos2D를 많이 사용 하시는 분들이 계신다 

그 분들을 위해서 cocos2D에서 iAd를 사용 하는법을 잠시 적겠습니다.

cocos2D를 사용 하여 임시적으로 하나의 프로젝트를 생성 합니다.

일반 프로젝트를 생성 하면 나오는 Hello World 프로젝트 입니다. 밑에 부분은 많이 봤을 것입니다.

if( (self=[super init] )) 

{

//cocos2D는 Layer이나 Scene이나 Node를 상속 받아서 사용 합니다.

//View단에서 움직이는 부분이 없으므로 

//ViewController를 동적 생성 해줍니다.

//ADBannerView도 역시 동적 생성 해줍니다.

UIViewController *controller = [[UIViewController alloc]init];   //동적 생성.

controller.view.frame = CGRectMake(0,0,480,320);                 //Hello World가로 방향 

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];

adView.requiredContentSizeIdentifiers  =                      [NSSet setWithObject:ADBannerContentSizeIdentifier480x32];

adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier480x32;//ADBannerContentSizeIdentifier480*32;

       [controller.view addSubview:adView];    //View 위에 배너를 add하시면 됩니다.

       [[[CCDirector sharedDirector] openGLView] addSubview:controller.view];

// create and initialize a Label

        CCLabel* label = [CCLabel labelWithString:@"Hello World" fontName:@"Marker Felt"                        fontSize:64];


// ask director the the window size

CGSize size = [[CCDirector sharedDirector] winSize];

// position the label on the center of the screen

label.positionccp( size.width /2 , size.height/2 );

// add the label as a child to this Layer

[self addChild: label];

}

////////////*지금 View 및 Banner 두개다 동적할당을 하였기 때문에 delloc 에서 release를 잊으시면 안될꺼 같아 보입니다.  *

//======================================================================================
일반 프로젝트의 Banner추가 방법 입니다. cocos2D를 사용 하지 않았으므로 View위에서 실행 될것으로 압니다.

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];

adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];

//adView.delegate = self;

adView.frame = CGRectMake(0,430,320,50);

[self addSubview:adView];


//========================================================================================
이 부분도 release를 꼭 해주어야 할꺼 같네요.. ^^ 이상 입니다..~!~!~!

// 빈 문자열 생성하기
NSString *str1 = [NSString new];


//일반적인 문자열 대입 - 문자열 상수

str1 = @"web2log.com";


//포멧 문자열(stringWithFormat) - 변수 대입방식
NSString *str2 = [NSString stringWithFormat:@"Hi, %@",str1];


//포멧 문자열(stringWithFormat) - 숫자 대입방식

NSString *str3 = [NSString stringWithFormat:@"Integer, %d",123456];


//포멧 문자열(stringWithFormat) - 문자열 대입방식

NSString *str4 = [NSString stringWithFormat:@"stringWithFormat, %s","web2log.com"];


//Object-C형식 문자열

NSString *str5 = [NSString stringWithString:@"web2log.com"];  


//C형식 문자열

NSString *str6 = [NSString stringWithCString:"web2log.com"];


//문자열 Append (추가)

NSString *str7 = [str6 stringByAppendingString:@":web2log.com"];


//문자열 길이 구하기

int len = [str7 length];


//String형을 int형으로 형변환하기

int vInt = [@"1234" intValue];


//String형을 float형으로 형변환하기

float vFloat = [@"1234.56" floatValue];


//메모리 할당한 문자열 변수 제거

[str1 release];


------------------------------------------------
참고]http://web2log.com/38


NSString를 int로 변환 하는 방법.


NSString *nStr;
nStr = @"16";
int j = [nStr intValue];



int를 NSString로 변환 하는 방법.

int j = 0;
NSString *nStr = [NSString stringWithFormat:@"%d",j];


=======================================================================



[펌글]

iPhone 어플을 개발하고 나면 앱스토어에 올리기 위해서 배포를 위한 어플리케이션을 빌드 할 수 있어야 한다. 여기에는 크게 5가지 과정이 있다. 그리고 어플리케이션을 앱스토어에 올리기 전에 준비해야할 이미지등을 미리 준비하면 편한데 그 것에 대해서도 정리.

어플리케이션 배포 전 준비해야할 것들

  • Icon.png 파일
    • 57 x 57 pixels, with 90 degree corners
    • 아이폰, 아이팟터치의 홈스크린 화면에 나오는 아이콘
    • shine, gloss 이펙트를 주지 말 것
    • 알파 투명도를 사용하지 말 것
  • 512 x 512 pixels, (jpg format)
    • 어플리케이션 아이콘 파일의 rich 버젼.
    • 단순이 Icon.png 파일을 스케일업한 것은 좋지 않고, 더 자세한 그림이 좋다.
    • 앱스토어에 표시될 그림
  • 스크린 샷 3장 정도
    • 앱 스토어에 표시될 스크린 샷
    • iPhone 상태바를 포함하지 않는게 좋다.
    • 스크린샷은 최소 320 x 460 portrait, 480 x 300 landscape, 320 x 480 portrait 의 크기를 가질 것
  • 어플리케이션 설명문
    • 미리 작성해 두는 것이 좋다.
    • 최대 4000 characters
  • 배포용 어플리케이션 빌드
    • 배포용 빌드를 만드는 과정은 아래에 더 자세히 설명.



배포용 어플리케이션 빌드를 만드는 과정 (Ad Hoc 배포 과정은 포함하고 있지 않음)
기본적으로 iPhone 장치에서 프로그램을 실행하기 위한 과정과 비슷하다. Provisioninig Profile을 배포용으로 만드는 것과 빌드 옵션을 설정하는 것이 다르며, 앱 스토어에 올리는 과정은 어렵지 않다.

  1. iPhone Distribution Certificate를 생성하는 과정
    • 어플리케이션을 제출하기 위해서는 인증서(certificate)를 생성해야하고, 이는 팀 에이젼트만 할 수 있다. 그리고 생성된 인증서를 통해서만 해당 어플리케이션이 제출될 수 있다.
    • 인증서를 요청하기 위해서 응용프로그램-유틸리티-키체인 접근(Keychain Access)를 실행시킨다.
    • 환경설정의 인증서패널에서 OCSP와 CRL을 끈다.
    • 키체인 접근 - 인증 지원 - 인증 기관에서 인증서 요청을 선택한다.
    • 사용자 이메일 주소에는 iPhone Developer에 등록할 때 제출한 이메일 주소를 적는다.
    • 일반 이름에는 회사/기관/부서의 이름을 적는다. iPhone Developer에 등록할 때 제출한 것을 적는다.
    • CA 이메일 주소는 적지 않는다.
    • '디스크에 저장됨'을 선택하고, '자신이 키페어 정보 지정'을 체크한다. (있으면)
    • '자신이 키페어 정보 지정'을 선택했으면 키 사이즈는 2048 bits, 알고리즘은 RSA를 선택하고 계속을 누른다. CSR 파일이 desktop에 생성될 것이다.
    • 만들어진 CSR파일을 제출하고 승인을 받아야 한다. 그러기 위해서 iPhone Developer Program Portal로 접속한다.
    • 'Certificates' -> 'Distribution'을 선택하고 'Add Certificate'를 선택한다.
    • Upload file을 눌러서 CSR파일을 선택하고 'Submit'버튼을 누른다. (주의: 키를 생성할 때, 키 사이즈가 2048로 설정되지 않았으면 CSR파일이 승인되지 않을 것이다.)
    • iPhone Distribution Certificate을 승인한다.
    • 'Certificates' -> 'Distribution'에서 WWDR Intermediate Certificate 링크를 컨트롤-클릭하고 'Saved Linked File to Downloads'를 선택한다. 다운로드가 완료되면 더블 클릭하여 '키체인 접근' 프로그램에 설치한다.
    • 'Certificates' -> 'Distribution'에서 certificate의 이름을 클릭하여 다운로드하고 다운로드된 .cer파일을 더블 클릭하면 '키체인 접근'프로그램에 certificate가 설치된다.
  2. App ID를 생성 과정
    • 'App IDs'에서 'New App ID'를 클릭한다.
    • 'Description'에 어플리케이션 이름을 적는다.
    • 'Bundle Seed ID'는 'Generate New'를 선택한다.
    • 'Bundle Identifier'는 프로덕트 홈페이지 url을 역순으로 적는다. ( ex, com.tistory.leesort )
    • App ID를 생성한다.
  3. iPhone Distribution Provisioning Profile 을 만드는 과정
    • 'Provisioning' -> 'Distribution'에서 'App Store' 라디오 버튼을 클릭한다.
    • Profile Name에 어플리케이션 이름등을 적는다.
    • App ID는 2번 과정에서 생성한 App ID를 선택한다.
    • 'Submit' 버튼을 눌러 Profile을 제출하고, 해당 프로파일(확장자 .mobileprovision)을 다운로드 받는다.
    • 다운 받은 .mobileprovision파일을 dock에 있는 Xcode또는 iTunes아이콘 에 드래그한다.
  4. 배포용 버전으로 빌드하는 과정
    • Xcode를 열고 프로젝트를 오픈한다.
    • Project' Info 패널을 열고 'Configuration' 탭으로 이동한다.
    • 'Release'를 선택하고 'Duplicate' 버튼을 선택한다.
    • duplicate된 새 configuration의 이름을 'Distribution'으로 변경한다.
    • 'Build'탭으로 이동하여 'Configuration'을 'Distribution'으로 변경한다.
    • 'Base SDK'에 지원하는 베이스버젼를 선택한다.
    • 'Code Signing' - 'Code Signing Identity' - 'Any iPhone OS Device' 항복에 생성한 배포용 Provisioning Profile을 선택한다. ( ex, iPhone Distribution: ~~ )
    • Info.plist파일의 Bundle display name에 아이폰 홈스크린에서 보일 어플리케이션의 이름을 입력한다.
    • Info.plist파일의 Bundle identifier을 2번 과정의 App ID를 생성할 때 입력한 Bundle identifier를 입력한다.
    • Info.plist파일의 Bundle version을 설정한다. (처음은 보통 1.0에서 시작한다.)
    • 프로젝트 윈도우에서 'Active Configuration'을 'Distribution'을 선택한다.
    • 프로젝트 윈도우에서 'Active SDK'를 'Device - 해당 버젼'으로 선택한다.
    • 'Build' - 'Build'를 선택하여 빌드한다. 빌드할 때에는 57 x 57 pixels Icon.png파일을 꼭 포함한 버젼이어야 한다.
    • 'Products' 그룹에서 생성된 .app파일을 선택하고 오른쪽 클릭하여 'Reveal in Finder'를 선택한다.
    • Finder에서 .app파일을 선택하고 오른쪽 클릭하여 압축을 하는 메뉴를 선택한다. (주의: .app파일만 압축해야 한다.)
  5. 앱스토어에 어플리케이션을 업로드 하는 과정
    • 'iTunes Connect' 페이지로 이동한다.
    • 'Manage Your Applications'으로 이동하여 'Add New Application'을 선택한다.
    • 기본적인 문항을 자신의 어플리케이션에 맞게 작성한다.
    • Application Name: 앱 스토어에 보여지게 되는 이름 (애플 관련 단어를 포함하면 안됨, 버젼 정보를 이름에 넣지 말 것, 20 characters이내로 유지하는 게 좋다. 잘림 방지)
    • Application Description: 준비한 어플리케이션 설명문
    • SKU Number: 개발자가 지정하는 어플리케이션 관리코드
    • Keywords: 앱스토어 검색어 지정 (애플 관련 단어, 저작권 위반, 유명 인사등의 검색어등을 적지 말 것)
    • Application URL, Support URL: 어플리케이션 홈페이지, 개발자 블로그 등의 웹 페이지 url
    • Demo: 애플이 어플리케이션을 리뷰할 때에 도움이 될만한 사항, 정보 ( guest id, password 등등)
    • 등등 나머지 문항을 작성한다.
    • 'Ratings'
      • 어플리케이션의 등급을 설정하는 단계. 폭력적인 장면이 있는가? 선정적인가? 등등의 질문에  답하면 된다.
    • 'Upload'
      • Application: 압축한 zip파일을 업로드한다.
      • Large 512 icon: 512 * 512 jpg 파일
      • Primary Sreenshot: 어플리케이션 주요 스크린샷을 업로드 한다.
      • Additional Screenshots: 나머지 스크린샷을 업로드 한다.
    • 'Pricing'
      • 어플리케이션이 리뷰가 완료되어 등록 허가가 나면 Sale을 시작하게될 날짜를 선택.
      • 가격 선택: 해당하는 어플리케이션의 가격을 선택한다.
    • 'Localization'
      • 어떤 나라의 앱스토어에서 판매할 것인가 등등을 선택한다.
    • 최종 확인을 거치고 등록 완료한다.
    • 애플의 진행 상태를 확인하면서 애플로 부터의 피드백을 기다린다.
    • 만약 Reject이 나면 수정 사항을 고치고 4번 과정부터 다시 진행한다.


참고


// Get Documents Directory

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];


// Create Directory

NSString *tmpDir = [documentsDirectory stringByAppendingPathComponent:@"test_dir"];

mkdir([tmpDir cStringUsingEncoding:NSASCIIStringEncoding], 0777);


// Open File

NSString *tmpFile = [documentsDirectory stringByAppendingPathComponent:@"test_file.txt"];

FILE *file = fopen([tempFile cStringUsingEncoding:NSASCIIStringEncoding], "w");;

//h파일


#import "cocos2d.h"


@interface SpritePosChange : CCScene {

}


-(void) SpritePosChange:(CCSprite*)mSprite : (int) xPos : (int) yPos;


@end




//m파일

#import "SpritePosChange.h"



@implementation SpritePosChange

-(id) init

{

if((self = [super init]))

{

}

return self;

}

-(void) SpritePosChange:(CCSprite*)mSprite : (int) xPos : (int) yPos

{

mSprite.anchorPoint = ccp(0,1);

mSprite.position = ccp(xPos,480-yPos);

}

-(void)dealloc

{

[super dealloc];

}


@end



//아주 간단한 클래스 입니다 ^^ 왕초보라서.~! 그냥 좌상단이 보통 0,0 인데  OpenGl의 기준점은 좌하단이 0,0으로 되어 있어서 
  디자이너들의 좌표 와 정반대로 찍혀 있어서 그냥 만들어 봤음. ^^

//
CString => const char* 변환

CString src = _T("test");
const char* dest;
dest = (CStringA)src;


cosnt char* => CString 변환
const char* src = "test";
CString dest;
dest = (CString)src;

CStringT type  : Declaration
----------------------------------------------------------------------------
CStringA        : An ANSI character type string with CRT support.
CStringW       : A Unicode character type string with CRT support.
CString          : Both ANSI and Inocode character types with CRT support.
----------------------------------------------------------------------------

출처 : http://chaosura.egloos.com/4197783

# 함수 호출시에 사용한 매개변수를 정리하는 세가지 방법

- 함수가 종료 된 후에 호출시 사용한 매개변수를 저장한 스택 위치를 정리해 주는 방법으로 esp의 위치를 함수 호출이 일어나기 전의 위치를 옮겨 주는 것

1. __cdecl
  - c/c++에서 디폴트로 사용
  - 함수 호출 시 매개변수가 제일 우측에서 좌측 순서로 스택에 쌓인다
  - 함수를 호출한 부모함수측에서 스택을 정리해 준다.([add esp, 숫자]의 형태로 표현)

2. __stdcall
  - Windows API 에서 사용
  - 함수 호출 시 매개변수가 제일 우측에서 좌측 순서로 스택에 쌓인다
  - 호출당한 자함수측에서 스택을 정리 해준다. ([ret 숫자]의 형태로 표현)

3. __fastcall
  - 매개변수가 두개 이하라면 ecx레지스터와 edx레지스터를 사용하며, 세개 이상이라면 가장 우측부터 스택에 쌓인다.
  - 호출당한 자함수측에서 스택을 정리 해준다.
  => ecx레지스터와 edx레지스터를 매개변수 호출에 사용하기 때문에 스택에 ecx와 edx를 넣어 두고, 매개변수가 정리 된 후 스택에서 pop 시켜서 ecx와 edx를 복구 시켜준다.

--------------------------------------------------------------------------------------------------------------
-_ -;;뭔가 어려운듯한.. 세계 ㅋ

+ Recent posts