0

99.9% 縦長のアプリケーションがあります。ただし、ユーザーが投稿を作成する際により多くのスペースを確保できるように、横向きを許可する画面が 1 つあります。私の問題は、ユーザーが横向きモードのときに編集画面から、縦向きモードでしか表示できない前の画面に戻ることを決定したときに発生し、ナビゲーション バーが切り取られます。

ファンキーなナビゲーション バー

誰かがこれを以前に見たことがありますか、または問題を解決する方法について何か考えがありますか?

編集目立つかどうかはわかりませんが、NavigationBar を描画できる領域が、ビューが横向きモードの場合と同じ高さに切り捨てられ、黒いバーが縦方向の NavigationBar との違いですheight と Landscape NavigationBar の高さ。

4

2 に答える 2

0

使用している場合:

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

元のビュー (風景) がまだ存在します。

使用:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

ビューインターフェイスを調整します。

あなたがしていることについてもっと情報を提供する必要があるため、これはすべて推測です。それが原因です。

于 2012-09-04T22:10:41.190 に答える
0

以下のコードを使用して、回転前に self.view のスーパービューとサブビューをダンプし、次に回転が完了した後、縦向きに戻る回転が完了したときに再びダンプします。ビューの 1 つが元の元のビューと一致せず、それが問題のビューになります。原点の変更は、上部/左側で支柱が有効になっていないことが原因である可能性があります。

これは私に何度も起こり、スーパービューとサブビューをダンプするためにこの UIView カテゴリを書きました。

使用法:

[UIView dumpSuperviews:self.view msg:@"Original superviews"];
[UIView dumpSubviews:self.view msg:@"Original subviews"];

コード:

#import <QuartzCore/QuartzCore.h>

#import "UIView+Utilities.h"

@interface UIView (Utilities_Private)

+ (void)appendView:(UIView *)v toStr:(NSMutableString *)str;

@end

@implementation UIView (Utilities_Private)

+ (void)appendView:(UIView *)a toStr:(NSMutableString *)str
{
    [str appendFormat:@"  %@: frame=%@ bounds=%@ layerFrame=%@ tag=%d userInteraction=%d alpha=%f hidden=%d\n", 
        NSStringFromClass([a class]),
        NSStringFromCGRect(a.frame),
        NSStringFromCGRect(a.bounds),
        NSStringFromCGRect(a.layer.frame),
        a.tag, 
        a.userInteractionEnabled,
        a.alpha,
        a.isHidden
        ];
}

@end

@implementation UIView (Utilities)

+ (void)dumpSuperviews:(UIView *)v msg:(NSString *)msg
{
    NSMutableString *str = [NSMutableString stringWithCapacity:256];

    while(v) {
        [self appendView:v toStr:str];
        v = v.superview;
    }
    [str appendString:@"\n"];

    NSLog(@"%@:\n%@", msg, str);
}

+ (void)dumpSubviews:(UIView *)v msg:(NSString *)msg
{
    NSMutableString *str = [NSMutableString stringWithCapacity:256];

    if(v) [self appendView:v toStr:str];
    for(UIView *a in v.subviews) {
        [self appendView:a toStr:str];
    }
    [str appendString:@"\n"];

    NSLog(@"%@:\n%@", msg, str);
}

@end
于 2012-09-04T22:17:45.253 に答える