1

cocos2dを使用するiPadアプリで完全なデバイスの向きをサポートしたい。これを実現するために、cocos2dを使用せずにアプリで作業していたときと同じように、shouldAutorotateToInterfaceOrientationに対してYESを返すと思いましたが、この場合、ビューのサイズが適切に変更されません。私が最終的に得たものをあなたに示すために、それはサンプル写真です。 サイズ変更されていないビュー

向きは横向きですが、ビューはまだ縦向きであることがわかります。誰かが私が間違っていることを教えてもらえますか?

4

2 に答える 2

1

次の関数を追加し、それぞれの変更を行います

-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    switch (toInterfaceOrientation) {
        case UIInterfaceOrientationPortrait:
            break;
        case UIInterfaceOrientationLandscapeLeft:
            break;
        case UIInterfaceOrientationLandscapeRight:
            break;
        case UIInterfaceOrientationPortraitUpsideDown:
            break;
        default:
            break;
    }
}
于 2012-06-29T04:09:33.167 に答える
0

ビューの autosize プロパティを設定する必要があります。簡単な方法は、「サイズインスペクター」で設定することですサイズインスペクター

于 2012-06-28T18:40:57.670 に答える