Views 18463 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
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];
}

?

  1. [C#] MD5, SHA1 해시 & 인코딩

  2. 디피헬만(Diffie-Hellman) 초간단 개념..

  3. [c#] 웹문서 소스(html) 긁어오기

  4. [sql] insert into select 사용하기

  5. [android] 만화 어플 소스코드

  6. [ios] 미스터피자(Mr.pizza) 어플

  7. [iphone] 아이폰 어플 모음 ㅋㅋ

  8. [android] 안드로이드 어플 모음 ㅎㅎ

  9. [lego] 세그웨이 이것만 볼것.. ㅎㅎ

  10. [json] 종결자 (설명과 웹, C/C++/C# 프로그램 샘플 코드)

  11. [c#] Hashtable <-> Json (dll 포함)

  12. [c#] Json 라이브러리 (System.Net.Json.dll)

  13. [c#] 간단한 IPC 통신 예제

  14. [c#] 간단한 소켓통신 예제..

  15. [c#] 비동기 통신 샘플 코드 ㅎㅎ

  16. [c#]업글 뉴 툴바 개인적으로 만든거.. (new) ㅋㅋ

Board Pagination Prev 1 ... 29 30 31 32 33 ... 74 Next
/ 74