1

このコードは、splitviewアプリのDetailView.mで使用しています。これで、デバイスが回転したときにのみ方向の変更が発生します。アプリの起動時に検出は行われません。私もこの警告を受け取ります

警告:「RootViewController」は「-adjustViewsForOrientation:」に応答しない可能性があります

アプリの起動時にアプリにオリエンテーションコードを調整させるには、どのような変更が必要ですか。

> - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
> duration:(NSTimeInterval)duration {
>     [self adjustViewsForOrientation:toInterfaceOrientation];
> }
> 
> - (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation
> {
>     if (orientation == UIInterfaceOrientationLandscapeLeft ||
> orientation ==
> UIInterfaceOrientationLandscapeRight)
> {
>         detailDescriptionLabel.center = CGPointMake(235.0f, 42.0f);
>         bigthumbImageView.center = CGPointMake(355.0f, 70.0f);
>         
>     }
>     else if (orientation == UIInterfaceOrientationPortrait ||
> orientation ==
> UIInterfaceOrientationPortraitUpsideDown)
> {
>         detailDescriptionLabel.center = CGPointMake(160.0f, 52.0f);
>         bigthumbImageView.center = CGPointMake(275.0f, 80.0f);
>         
>     } }
4

2 に答える 2

1

次のように、RootViewController.hでメソッドを宣言する必要があります。

- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation;

そうしないと、警告が表示されます。アプリの起動時にビューが確実に回転するようにするには、applicationDidFinishLaunchingメソッドのAppDelegateクラスにadjustViewsForOrientationの呼び出しを追加します。

于 2010-05-13T10:15:52.907 に答える
1
于 2010-05-13T10:18:38.367 に答える