私はしばらくの間働いていて、ゲームを出荷しているエンジンは現在私の現在のプロジェクトを逆さまにして、すぐにUIViewを回転させます。私は、コードとのインタフェースを作成し、これは次のように、それがどのように見えるかについてです:問題は、私はUIInterfaceOrientationLandscapeLeftでアプリケーションを起動する場合にのみoccures私のアプリは逆さまになります
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
CGRect screenBounds = [[UIScreen mainScreen] applicationFrame];
CGRect windowBounds = screenBounds;
windowBounds.origin.y = 0.0;
UIWindow* win = [[UIWindow alloc] initWithFrame:windowBounds];
win.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
UIMyView* view = [[UIMyView alloc] initWithFrame:screenBounds];
UIMyViewController* controller = [[UIMyViewController alloc] init];
controller.view = view;
view.multipleTouchEnabled = true;
view.windowWrapper = this;
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[win addSubview:view];
...
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
{
s32 validOrientations = ((cViewMM*)(self.view)).windowWrapper->GetValidOrientations();
if (toInterfaceOrientation == UIInterfaceOrientationPortrait && (validOrientations & 0x01))
return true;
if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown && (validOrientations & 0x02))
return true;
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft && (validOrientations & 0x04))
return true;
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight && (validOrientations & 0x08))
return true;
return false;
}
。私が内部的にshouldAutorotateToInterfaceOrientation:を複数回呼び出すと、ウィンドウにビューを追加しようとしたときのアプリケーションのデバッグ。最初にUIInterfaceOrientationPortraitがfalseを返し、UIInterfaceOrientationLandscapeRightがtrueを返します(有効な向きなので)。次にUIInterfaceOrientationLandscapeLeftがtrueを返します(これは有効な向きであり、デバイスの現在の向きなので)。
ああ、もっと具体的には、これはiPad上ではなくiPhone上でのみ起こっています。彼らはこのビューを設定するために同じコードを使用します。
私は間違っていますか?
- EDIT -
私はshouldAutorotateToInterfaceOrientationの実行に関する間違っていたOK:それはその後、一度UIInterfaceOrientationLandscapeRightため、UIInterfaceOrientationLandscapeLeftため、UIInterfaceOrientationPortraitを求めて2回を3回実行し、再びUIInterfaceOrientationLandscapeLeft一度れます。
GameCenterは、この時点ではまだ初期化中です。追加のUIを追加しているので、それはそうかもしれないと思っていましたが、そうではありませんでした。
「私は間違っていますか?あなたの頭に立っていない? =] –
もしそれが私を助けるつもりなら。 – Aleks