0

タブバー ビュー コントローラーにカスタム ビューがあります。カスタム ビューの自動サイズ変更マスクを設定しましたが、iPhone 5 の画面で整列されません。iPhone 4の画面では問題なく見えます。ビューにこのコードがあり、タブバービューコントローラーのメソッドをロードしました。

self.customBadge = [CustomBadge customBadgeWithString:[AppGlobals sharedInstance].badgeNumber];


     self.customBadge.frame = CGRectMake(165, 420,  self.customBadge.frame.size.width,  self.customBadge.frame.size.width);
    self.customBadge.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
    [self.view addSubview: self.customBadge];
4

1 に答える 1

0

TabBarの全体図(ほとんどの画面)に合わせた座標でバッジを追加しているようです

試す:

  1. タブバー ビュー自体のサブビューとしてバッジを追加します (フレームの Y を 420 から約 5 ~ 10 に下げることができます)。

    [self.tabBar addSubview:self.customBadge];

  2. (1) が機能しない場合は、ハードコードされた y 値を試すことができます (これは悪い習慣ですが、行き詰まっている場合は機能するはずです)。

    #define VALUE_BY_SCREEN_HEIGHT(regular, longScreen) (([[UIScreen mainScreen] bounds].size.height <= 480.0) ? regular : longScreen)

    ...

    self.customBadge.frame = CGRectMake(165, VALUE_BY_SCREEN_HEIGHT(420,508), self.customBadge.frame.size.width, self.customBadge.frame.size.width);

于 2012-11-05T08:25:57.783 に答える