2012-03-01 14 views
0

私はウィンドウベースのアプリケーションを作成し、2つのUIViewサブクラスを追加しました.1つはメインウィンドウ、もう1つはコンテンツウィンドウです。iOS Beginner:画面の向き

私のアプリは横長モードにする必要があります。

  • 追加「初期インターフェイスの向き」の情報を投影するキー、およびに「風景
  • セット「サポートされるデバイスの向き」に設定します。さて、ここで私がやったものです"風景" 私はshouldAutorotateToInterfaceOrientation機能にYESを返された、私のビューの.mファイルの両方で

これは作業です。しかし、私はビューを切り替えると、何らかの理由で私は醜いポートレートベースのインターフェイスをランドスケープモードで参照し、インターフェイスは2秒後に風景に切り替わります。それはなぜ起こるのですか?

答えて

0

ビューはYESを返すはずです横向きの場合はreturn (interfaceOrientation == UIInterfaceOrientationLandscapeRight);)です。

1

あなたはshouldAutorotateToInterfaceOrientationでこれを返す必要があります:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 

} 

彼は、私はまだ同じ結果を得る新しいinterfaceOrientation

+0

に回転させることができればアプリがビューに尋ねる場所です。 MainWindow.xibと関係があると思います。ランドスケープモードにする方法はありますか? – NoobDev4iPhone

+0

はい、Interfaz Builderでは、ビューのプロパティでSimulated Metricsセクションで、方向Orientation to Landscape –

+1

または単にreturn UIInterfaceOrientationIsLandscape(interfaceOrientation);を変更できます。 –