2013-01-07 2 views
0

AdMob의 광고를 설치하고 있는데 GADBannerView가 있습니다.특정보기 만 회전하도록 허용하는 방법은 무엇입니까? (iPhone)

설치 후, 배너 쇼를 클릭하면 페이지가 전체 화면으로 축소되어 광고 내용이 표시됩니다.

질문은 동영상과 같은 광고 콘텐츠가 가로로 재생되어야한다는 것입니다. 그러나 응용 프로그램이 가로로 볼 수 있도록 설계되지 않았으므로 응용 프로그램의 다른 부분이 회전하는 것을 원하지 않습니다.

그렇다면 어떻게 이러한 기능을 구현할 수 있습니까?

답변

0

이 질문에 답변 해 주셨습니다. 이는 단일보기 응용 프로그램의 나머지 부분에서 지원하지 않는 특정 방향으로 작동하는 방법에 대해 설명합니다 :

AutoRotate ONLY MpMoviePlayerControler iOS 6

1

봅니다 이것에 대한 알림을 사용 할 수 있습니다. 장치 방향이 변경 될 때마다 알림이 선택기를 호출합니다. 당신의 viewDidLoad에서

쓰기이 :

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];  
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setScreenWithDeviceOrientation:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; 

후 다음과 같이 선택기를 정의는 : UR 장치가 방향을 변경하면

-(void)setScreenWithDeviceOrientation:(NSNotification *)notification 
{ 
    UIDeviceOrientation orientation=[[UIDevice currentDevice] orientation]; 

    if(orientation==UIInterfaceOrientationPortrait) //Portrait orientation 
    { 
     // setView frame for portrait mode  
    } 
    else if(orientation==UIInterfaceOrientationPortraitUpsideDown) // PortraitUpsideDown 
    { 
     // setView frame for upside down portrait mode 
    } 
    else if(orientation==UIInterfaceOrientationLandscapeLeft) 
    { 
     // setView frame for Landscape Left mode 
    } 
    else if(orientation==UIInterfaceOrientationLandscapeRight) //landscape Right 
    { 
     // setView frame for Landscape Right mode 
    } 
    else 
    { 
     NSLog(@"No Orientation"); 

    } 

} 

이 방법은 매번 발사했다. 현재 방향에 따라보기를 조정해야합니다.

이 정보가 도움이되기를 바랍니다.

1

iOS 6를 사용하고 계십니까? 이 경우보기 컨트롤러가 처리하는 방향을 제한 할 수 있어야합니다.

// Tell the system what we support 
- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskPortrait; 
} 

// Tell the system It should autorotate 
- (BOOL) shouldAutorotate { 
    return NO; 
} 

// Tell the system which initial orientation we want to have 
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationPortrait; 
} 

을 그리고 당신의 ViewController는 초상화를 지원하는 그래서 그것을 확인해야합니다 : 예를 들어, GADBannerView도 처리 뷰 컨트롤러에, 당신은 넣을 수 있습니다.

관련 문제