0

特定のコードを使用して、ナビゲーション バーを透明にしています。しかし、ツールバーのようにナビゲーションバーの下にあるビューをシフトしていて、ナビゲーションバーのタイトルと一致しています。

コードは次のとおりです。

(void)SetNavigationBarTransparent:(UINavigationController *)navicon{
NSLog(@"the navigation bar in app delegate is %@", navicon);
// these lines are for making the navigation bar transparent and making it submersible 
  with the view below it.
navicon.navigationBar.translucent = YES; // Setting this slides the view up, underneath 
the nav bar (otherwise it'll appear black)
const float colorMask[6] = {222, 255, 222, 255, 222, 255};
UIImage *img = [[UIImage alloc] init];
UIImage *maskedImage = [UIImage imageWithCGImage: 
CGImageCreateWithMaskingColors(img.CGImage, colorMask)];


[navicon.navigationBar setBackgroundImage:maskedImage forBarMetrics:UIBarMetricsDefault];
//remove shadow
if ([navicon.navigationBar respondsToSelector:@selector(shadowImage)])
{
    [navicon.navigationBar setShadowImage:[[UIImage alloc] init]];
}

}

すべてのバー ボタンとタイトルがそのまま表示された状態でバーを確実に透明にしたいので、ビューが上に移動しないようにするにはどうすればよいでしょうか。

どんな助けでも大歓迎です。ありがとう!

ビューの自動サイズ変更は次のとおりです。ここに画像の説明を入力

その場所にとどまるためにここで何ができるでしょうか。

4

1 に答える 1

0

autoresize maskストーリーボードまたはコードを使用して、ビューを固定上部マージンに設定します。

于 2013-09-03T06:11:38.473 に答える