본문 바로가기

Apple - IPhone / IPod Touch/cocos2d-x

cocos2d-x 화면 세로로 설정하기

// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead

- (NSUInteger) supportedInterfaceOrientations{

#ifdef __IPHONE_6_0

    //return UIInterfaceOrientationMaskLandscape;

    return UIInterfaceOrientationMaskPortrait; // 세로 화면

    

#endif

}



// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead

- (NSUInteger) supportedInterfaceOrientations{

    

        NSInteger mask = 0;

#ifdef __IPHONE_6_0

    //return UIInterfaceOrientationMaskLandscape;

    //return UIInterfaceOrientationMaskPortrait; // 세로 화면

    


    if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortrait])

        mask |= UIInterfaceOrientationMaskPortrait;

    if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortraitUpsideDown])

        mask |= UIInterfaceOrientationMaskPortraitUpsideDown;

    

#endif

    

    return mask;

}


-(NSInteger)supportedInterfaceOrientations{
NSInteger mask = 0;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight])
    mask |= UIInterfaceOrientationMaskLandscapeRight;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeLeft])
    mask |= UIInterfaceOrientationMaskLandscapeLeft;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortrait])
    mask |= UIInterfaceOrientationMaskPortrait;
if ([self shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationPortraitUpsideDown])
    mask |= UIInterfaceOrientationMaskPortraitUpsideDown;
return mask;
}


6.0 이상만 가능.....



Constants

UIInterfaceOrientationMaskPortrait

The view controller supports a portrait interface orientation.


UIInterfaceOrientationMaskLandscapeLeft

The view controller supports a landscape-left interface orientation.


UIInterfaceOrientationMaskLandscapeRight

The view controller supports a landscape-right interface orientation.


UIInterfaceOrientationMaskPortraitUpsideDown

The view controller supports an upside-down portrait interface orientation.


UIInterfaceOrientationMaskLandscape

The view controller supports both landscape-left and landscape-right interface orientation.


UIInterfaceOrientationMaskAll

The view controller supports all interface orientations.


UIInterfaceOrientationMaskAllButUpsideDown

The view controller supports all but the upside-down portrait interface orientation.





- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    //return UIInterfaceOrientationIsLandscape( interfaceOrientation );

    return UIInterfaceOrientationIsPortrait( interfaceOrientation );

    

}





안드로이드는




android:screenOrientation="landscape"

 landscape를 portrait로 변경