벨로우 나는 내 코드에 넣었다. 내 AppDelegate.h & .m. 이 코드는 내 MPMoviePlayerController가 전체 화면을 입력하고 전체 화면 통과 알림을 종료 한시기를 감지합니다. 알림이 호출되면 allowRotation
을 yes로 설정하면 사용자가보기를 회전 할 수 있습니다. 그러나 일단 사용자가 전체 화면을 흥분하고 여전히 일정한 과오 상태에있게되면 플레이어는 그 동영상을보고있는 동안 사용자가 놓았던 orieintation에서 화면을 떠난다. 이는 종료 전체 화면 알림이 호출되었지만 -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
이 호출되지 않기 때문입니다. 따라서 사용자가 장치를 회전 할 때만 포트 속도로 다시 회전합니다. 그러나 나는 이것을 원하지 않으며 통지가 호출되자 마자 회전하려고한다. 아무도 도와 줄 수 있니? 여기 사용자가 다시 입력 한 후보기를 회전하는 방법?
내 코드입니다 :
.H
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic) BOOL allowRotation;
@end
하는 .m @synthesize의 allowRotation;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillEnterFullscreenNotification:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayerDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];
allowRotation = NO;
return YES;
}
- (void) MPMoviePlayerDidExitFullscreen:(NSNotification*)notification {
NSLog(@"calling1");
self.allowRotation = NO;
}
- (void) moviePlayerWillEnterFullscreenNotification:(NSNotification*)notification {
NSLog(@"calling");
self.allowRotation = YES;
}
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (self.allowRotation == YES) {
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
else if (self.allowRotation == NO){
NSLog(@"portrait");
return UIInterfaceOrientationMaskPortrait;
}
}
CGAffineTransformMakeRotation을 사용하여 수동으로 회전시킬 수있는 – user2569812
을 수동으로 회전하도록 코드를 수동으로 코딩 할 수 있습니까? 답변을 http://stackoverflow.com/questions/15390359/how-to-rotate-a-view-in-controller-that-is-not-allowed-to-rotate-its-interface?rq에서 확인하십시오. = 1 – rydgaze