-1
저는 Xcode에 대해 배우기 시작했습니다. 모든보기 (가로, 세로)에서 올바른 방식을 볼 수 있어야하는 앱을 만들어야합니다. 여기서 조건은 자동 레이아웃을 사용해서는 안됩니다. 동일한 솔루션에 스토리 보드를 사용하는 다른 방법이 있습니까?Xcode에서 자동 레이아웃을 사용하여 방향을 사용하는 방법은 무엇입니까?
저는 Xcode에 대해 배우기 시작했습니다. 모든보기 (가로, 세로)에서 올바른 방식을 볼 수 있어야하는 앱을 만들어야합니다. 여기서 조건은 자동 레이아웃을 사용해서는 안됩니다. 동일한 솔루션에 스토리 보드를 사용하는 다른 방법이 있습니까?Xcode에서 자동 레이아웃을 사용하여 방향을 사용하는 방법은 무엇입니까?
다른 방법으로는 다음 위임 함수에서 프로그래밍 방식으로 프레임 및 기타 사항을 처리해야합니다. 가로 모드 용 코드 만 표시했습니다.
//THis only work for ios<6.0
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation== UIInterfaceOrientationPortrait || interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown)
{
return NO;
}
else
{
return YES;
}
}
//THis work for ios >=6.0
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
UIInterfaceOrientation interfaceOrientation=[[UIApplication sharedApplication] statusBarOrientation];
if(interfaceOrientation== UIInterfaceOrientationPortrait || interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown)
{
return NO;
}
else
{
//landscape mode code
return (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight);
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
UIInterfaceOrientation orientation=self.interfaceOrientation;
if(orientation== UIInterfaceOrientationPortrait || orientation==UIInterfaceOrientationPortraitUpsideDown)
{
//portrait mode code
}
else
{
//landscape mode code
}
}