회전 화면에서 잠 그려면 어떻게해야하나요? 앱 확장 프로그램이 세로 모드로만 설정되도록하고 싶습니다. 포토 내 확장 프로그램을 사용할 때 화면을 가로로 회전 할 수 있습니다.
감사
다음을 선택해야합니다.
1- 프로젝트에서 지원되는 인터페이스 방향으로 가로 및 세로를 설정 한 다음 각 ViewController에 대해 지원되는 인터페이스 방향을 재정의합니다.
2- 프로젝트에서 세로 모드 만 설정하고 필요한 ViewController에서 90도 회전을 만들 수 있습니다.
self.view.transform = CGAffineTransformMakeRotation(M_PI_2);
편집 : 이렇게 할 수 있습니다. 컨트롤러를 keyPath에 대한 관찰자로 설정하십시오 UIDeviceOrientationDidChangeNotification
. 그때:
-(void)changedOrientation: (NSNotification *)note
{
if (note)
{
UIDevice *dev = (UIDevice *)note.object;
if ([dev orientation] == UIInterfaceOrientationLandscapeRight)
{
self.view.transform = CGAffineTransformMakeRotation(M_PI_2);
}
else if ([dev orientation] == UIInterfaceOrientationPortrait)
{
self.view.transform = CGAffineTransformIdentity;
}
else if ([dev orientation] == UIInterfaceOrientationPortraitUpsideDown)
{
self.view.transform = CGAffineTransformIdentity;
}
else if ([dev orientation] == UIInterfaceOrientationLandscapeLeft)
{
self.view.transform = CGAffineTransformMakeRotation(-M_PI_2);
}
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다