Contents

조회 수 18514 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
iphone에서 화면에 대한 회전을 시키기 위한 간단한 코드는..
[[UIDevice currentDevice] setOrientation:orientation] 이다.
하지만, 이 코드는 non-public API 사용으로 인한 리젝 사유가 되므로 사용할 수 없기 때문에 아래와 같이 회전 관련 메서드를 만들어주어야 한다.

//화면 회전 처리
-(void)SetDeviceOrientation:(UIInterfaceOrientation)orientation
{
	
	//가로보기 강제
	if(orientation==UIInterfaceOrientationPortrait)
	{
		orientation=UIInterfaceOrientationLandscapeRight;
	}
	//세로보기 강제
	else if(orientation==UIInterfaceOrientationLandscapeRight)
	{
		orientation=UIInterfaceOrientationPortrait;			
	}	
	
	
	int radian=0;
	CGRect viewFrame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
	
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration: 0.2];
	
	if(orientation==UIInterfaceOrientationLandscapeLeft
	   || orientation==UIInterfaceOrientationLandscapeRight)
	{
		viewFrame = CGRectMake(0.0f, 0.0f, 480.0f, 320.0f);
		
	}	
	if(orientation==UIInterfaceOrientationPortrait)
	{
		radian=0;
	}
	else if(orientation==UIInterfaceOrientationPortraitUpsideDown)
	{
		radian=180;
	}
	else if(orientation==UIInterfaceOrientationLandscapeRight)
	{
		radian=90;
	}
	else if(orientation==UIInterfaceOrientationLandscapeLeft)
	{
		radian=270;
	}
	
	//뷰 회전 시키기
	CGAffineTransform transform =
	CGAffineTransformMakeRotation(degreesToRadian(radian));
	
	self.view.transform=transform;
	self.view.bounds=viewFrame;
	
	[UIView commitAnimations];
}


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
397 Develop [html] SVG(Scalable Vector Graphics) 간단 정리 hooni 2014.02.13 8868
396 Develop [html] HTML5 튜토리얼 링크 ㅋㅋ hooni 2013.04.23 12826
395 Develop [git] 쉬운 버전관리 Git 설명 hooni 2015.08.18 963
394 Develop [erp] SAP 모듈 요약 hooni 2013.04.23 15328
393 Develop [doc] 테크니컬 레포트 (BHO 취약점을 이용한 공격) 2 file hooni 2013.04.23 27136
392 Develop [doc] 유료 방송 제어 시스템 (CAS) 발표자료 file hooni 2013.04.23 8527
391 Develop [doc] UI개발시 유용한 소프트웨어 (개발 및 디버깅 툴) hooni 2013.04.23 12935
390 Develop [doc] mfc 매뉴얼 다운 받아서 완성하기.. ㅋㄷ file hooni 2013.04.23 7715
389 Develop [doc] Json Framework 설치와 사용 file hooni 2013.04.23 21960
388 Develop [doc] Equation Solving에 대한 발표자료.. file hooni 2013.04.23 7996
387 Develop [doc] C언어 문법 설명서 file hooni 2013.04.23 6459
386 Develop [doc] C++언어 문법 설명서 file hooni 2013.04.23 6194
Board Pagination Prev 1 ... 33 34 35 36 37 38 39 40 41 42 ... 71 Next
/ 71