본문 바로가기

프로그래밍

(65)
Scene과 Menu 만들기 작업할 파일을 다음과 같습니다. (1) MenuScene.h (2) MenuScene.m (3) GameDemoAppDelegate.m MenuScene.h // // MenuScene.h // GameDemo // // Created by cmpak on 5/7/10. // Copyright 2010 thefirstgood.com. All rights reserved. // //#import #import "cocos2d.h" //@interface MenuScene : NSObject { @interface MenuScene : CCScene { } @end MenuScene.m // // MenuScene.m // GameDemo // // Created by cmpak on 5/7/10. // C..
MKMapView 1. MapKit.framework 등록합니다. 2. #import #import @interface ImgGPSViewController : UIViewController { IBOutlet MKMapView *mapView; } @property (nonatomic, retain) MKMapView *mapView; @end 3. @synthesize mapView; // 위도, 경도 CLLocationCoordinate2D mapCenter; mapCenter.latitude = doubleValue; mapCenter.longitude = doubleValue; // 여기에 위도와 경로 값을 넣는다. // 지도의 기본 크기 MKCoordinateSpan mapSpan; mapSpan.latitud..
MKMapView에 MKAnnotation 사용하기 1. MapKit.framework 라이브러리를 추가한다. 2. #import #import @interface Annotation : NSObject { double dLatitude; double dLongitude; NSString *sTitle; NSString *sSubtitle; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; - (id)initWithLatitude:(double)latitude longitude:(double)longitude title:(NSString*)title subtitle:(NSString*)subtitle; - (NSString *)title; - (NSString *)subtitle; ..
iphone-exif 라이브러리 파일 보호되어 있는 글입니다.
JPEG 메타데이터 얻기 (iphone-exif 라이브러리 사용) 1. indlude.zip 파일 안에는 EXIF 관련 .m .h 파일이 들어있습니다. include.zip 파일의 압축을 풀어서 프로젝트 안에 추가 시킵니다. 2. AppDelegate.m 내부에 BOOL gLogging = FALSE; 을 적어줘야 합니다. 3. EXIF를 사용할 페이지 위에 #import "EXF.h" 를 선언해 줍니다. 4. 이미지 파일을 불러와서 메타데이터를 추출 후 위도와 경도를 가져옵니다. NSString * path = [[NSBundle mainBundle]pathForResource:@"IMG_0902" ofType:@"JPG"]; NSMutableData *imageData = [NSMutableData dataWithContentsOfFile:path]; EXFJpeg..
아이폰 GPS 사용하기 ♨ 프레임워크 추가 : CoreLocation.framework #import #import @interface LocationServiceViewController : UIViewController { CLLocationManager *locationManager; IBOutlet UILabel *latitude; IBOutlet UILabel *longitude; IBOutlet UILabel *Heading; } @property (nonatomic, retain) CLLocationManager *locationManager; @property (nonatomic, retain) IBOutlet UILabel *latitude; @property (nonatomic, retain) IBOutlet..
27. NSThread // 스레드는 한 함수를 관리한다. // 때문에 새로운 스레드가 실행되면서 함수를 실행하고, 함수가 끝나면 자연히 스레드가 종료된다. // 그래서 함수 내부에서 무한 루프를 돌면 스레드가 죽지않고 계속 유지됩니다. // 메인스레드의 이벤트루프가 이런 원리임. 이벤트루프에서 나와서 스레드가 끝난다는 것은 앱의 종료를 의미 // 생성 1 [NSThread detachNewThreadSelector:@selector(_th) toTarget:self withObject:nil]; // 생성 2 NSThread *thTime; thTime = [[NSThread alloc] initWithTarget:self selector:@selector(_th) object:nil]; [thTime start]; - (v..
26. View Controller 간의 변수 공유 View Controller 간의 변수 공유 하위 뷰에서 상위 뷰의 변수나 메소드를 호출하고 싶을때는 이렇게 사용하는 방법이 있습니다. SecondViewController 에 Instance 변수로 FirstViewController *parent를 선언합니다. 상위 뷰에서 호출할 때 SecondViewController *second = [[SecondViewController alloc] init]; // 하위 뷰 객체 생성 후 second.parent = self; // 하위 뷰와 자신을 포인터 연결 합니다. [self.navigationController pushViewController:second animated:NO]; 이렇게 하면 하위 뷰에서 parent.method... parent.v..