0

すべてのビューが自動回転するiPadアプリを作成しています。一つの見方は私に頭痛を与えています。

この質問の変種が数回前に尋ねられたことは知っていますが、実用的な解決策を見つけることができません。

アプリでルーチンを呼び出すことで、このビューに切り替えます。委任します。このルーチンのコードは次のとおりです。

- (void)flipToBack {
    //NSLog(@"%s", __FUNCTION__);

    DrawingViewController *drawView = [[DrawingViewController alloc] initWithNibName:@"Draw" bundle:nil];
    [self setDrawingViewController:drawView];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];

    [self.window addSubview:[drawView view]];
    [UIView commitAnimations];

    //  NSLog (@" FINISHED ");
}

これは、UIViewサブビューを備えたビューコントローラー(mvc)であり、後者は描画が行われる場所です。mvcもサブビューも正しく回転していません。

mvcでローテーションを呼び出すために使用しているコードは次のとおりです。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

mvcには上部と下部の2つのツールバーがあり、これらのサイズを変更する必要があります。これらも、回転に関係なく上下に留まる必要があります。

プロジェクトの概要には、すべてのオリエンテーションがサポートされていることが示されていますが、これはアプリ専用だと思います。初期化。

私はMVCのためにすべての支柱を持っています。

私は次のようなツールバーを作成しています:

UIInterfaceOrientation fieldOrient = [[UIApplication sharedApplication] statusBarOrientation];
    if ((fieldOrient == UIDeviceOrientationLandscapeLeft) || (fieldOrient == UIDeviceOrientationLandscapeRight)) {
        CGRect frame = CGRectMake(0, 50, 1024, 35 );
        topToolbar.frame = frame;
    } else {
        CGRect frame = CGRectMake(0, 50, 768, 35 );
        topToolbar.frame = frame;


UIInterfaceOrientation fieldOrient = [[UIApplication sharedApplication] statusBarOrientation];
    if ((fieldOrient == UIDeviceOrientationLandscapeLeft) || (fieldOrient == UIDeviceOrientationLandscapeRight)) {
        CGRect frame = CGRectMake(0, 650, 1024, 35 );
        bottomToolbar.frame = frame;
    } else {
        CGRect frame = CGRectMake(0, 950, 768, 35 );
        bottomToolbar.frame = frame;

私は明らかな何かが欠けていると思います。どんな助け/ポインターでもいただければ幸いです。

4

2 に答える 2

1

will rotate to interface orientation メソッドでフレームを設定してみてください:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    if ((toInterfaceOrientation == UIDeviceOrientationLandscapeLeft) || (toInterfaceOrientation == UIDeviceOrientationLandscapeRight)) {
        CGRect frame = CGRectMake(0, 650, 1024, 35 );
        bottomToolbar.frame = frame;
    } else {
        CGRect frame = CGRectMake(0, 950, 768, 35 );
        bottomToolbar.frame = frame;
}
于 2012-05-03T19:16:38.453 に答える
0

私にとっての答えは、ビューをモーダル ビューとして表示することでした。理想的ではありませんが、機能します。

于 2012-05-06T09:20:28.883 に答える