만 1 개 가로보기를 것이다, 그래서 내가 다른 모든에 대한 풍경을 차단하려는 허용, 나는이 시도 :iOS7에는/iOS8의 뷰 컨트롤러 만 세로 내가 아이폰 응용 프로그램을 구축하고
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
하지만 여전히 회전합니다.
만 1 개 가로보기를 것이다, 그래서 내가 다른 모든에 대한 풍경을 차단하려는 허용, 나는이 시도 :iOS7에는/iOS8의 뷰 컨트롤러 만 세로 내가 아이폰 응용 프로그램을 구축하고
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
하지만 여전히 회전합니다.
앱을 세로 모드로 설정 한 다음 가로 모드가 필요할 때마다 가로 모드를 허용 할 것을 제안합니다.
먼저, 이전에 제안 된대로 -> 프로젝트 이름 -> 일반 -> 배치 정보 -> 장치 오리엔테이션의 세로 만 선택하십시오.
둘째, 당신의 AppDelegate.h
이 속성을 추가로 ..
@property (nonatomic) BOOL fullScreenVideoIsPlaying;
그런 다음 AppDelegate.m
나는 뷰 컨트롤러에서이 작업을 수행 한 후이 기능 ..
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
if (self.fullScreenVideoIsPlaying == YES) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else {
return UIInterfaceOrientationMaskPortrait;
}
}
추가됩니다에 당신을 조경이 기능을 만들거나이 코드를 viewWillAppear
에 추가하는 방법은이 작업을 수행하려는 방식에 따라 다릅니다.
((AppDelegate *)[[UIApplication sharedApplication] delegate]).fullScreenVideoIsPlaying = YES;
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
그런 다음 세로 모드로 다시 설정이 작업을 수행 ..
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.fullScreenVideoIsPlaying = NO;
[self supportedInterfaceOrientations];
[self shouldAutorotate:UIInterfaceOrientationPortrait];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
당신은 나는 그것이 도움이되기를 바랍니다 .. 아이폰 OS 8
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate:(UIInterfaceOrientation)interfaceOrientation{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
이러한 기능을해야 할 수도 있습니다 .. :)
경우 [self presentMoviePlayerViewControllerAnimated : self.player]; ? –
왜 세로 모드 만 설정할 필요없이 가로 모드가 필요할 때마다 가로 모드를 허용할까요? – NorthBlast
@NorthBlast 나는 당신이 그것을 할 수 있다고 생각하지 않습니다. 프로젝트에서 인물 사진 만 사용하도록 설정하면 오리엔테이션 변경 사항이 전혀 통보되지 않습니다. – Fogmeister
나는 여러 번 .. :) 그리고 내 프로젝트는 세로 모드로 설정되어 있습니다 .. 프리 모드 강제로 알려진;) – NorthBlast