1. 단말기 위치 고정
-가로로 고정하고, 장치 방향 감지 기능을 이용해서 리소스를 가로 세로로 변경 예정
초기화 부분에 다음 추가
// 단말기 회전 통지 시작
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
통지 메소드 추가
-(void)didRotate:(NSNotification*)notification {
UIDeviceOrientation orientation = [[notification object] orientation];
if (orientation==UIDeviceOrientationLandscapeLeft) {
_orientation = 1; //좌 90도
} else if (orientation == UIDeviceOrientationLandscapeRight) {
_orientation = 2;
} else if (orientation == UIDeviceOrientationPortraitUpsideDown) {
_orientation = 3;
} else if (orientation == UIDeviceOrientationPortrait) {
_orientation = 4;
} else if (orientation == UIDeviceOrientationFaceUp) {
_orientation = 5;
NSLog(@”위—–“);
} else if (orientation == UIDeviceOrientationFaceDown) {
_orientation = 6;
}
[labelHeading setString:[NSString stringWithFormat:@”단말기 방향 : %d”,_orientation]];
NSLog(@”방향 : %d”,_orientation);
}

고민 거리.
현재는 방위값 변화에 따라 취득 된 값을 바로 나침반 회전 각으로 넣는 바람에 움직임이 튀는데, 부드럽게 보간 할 수 있는 방법을 찾아야 할듯.
정 뭐하면, 취득된 값을 0.5초 단위로 update로 보내 duration 0.5를 주고 시간당 회전방식으로 바꾸는 건 어떨까? 생각 중.







댓글 남기기