2012-02-28 14 views
0

に収まらない、なぜ、私のアプリは普遍的であるので、私はのviewDidLoadでこのコードを使用addviewは私が私の画面の下部にaddview表示する幅

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
     { 
      if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) 
      { 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 80.0f, 320.0f, 40)]; 

      } 
      else 
      { 
       NSLog(@"///////////////////////////// I'm here /////////////////////"); 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 80.0f, 1024 , 40)]; 


      } 
     } 
     else 
     { 
      if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) 
      { 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40.0f, 320.0f, 40)]; 

      } 
      else 
      { 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40.0f, 1024 , 40)]; 


      } 

     } 

     [adView setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin]; 
     //adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50; 




     [self.view addSubview: adView]; 
     [self.view bringSubviewToFront:adView]; 

問題はビューが決してということですiphoneでの仕事とうまくいくのiPadの幅を埋めない

すべての配置コードあなたはトンを持っているので enter image description here 敬具

答えて

1

それは、iPhone上で全く動作しないことを解決するためにどのように任意のアイデアコードはそのブロック内にあるため、ここではiPad用です。

幅を埋めるために、あなたは何が出現しているかを言わなかったので。

+0

もちろん、ipadの幅は768または1024である必要があります。 – ader

+0

私の質問を更新し、Apurvに応じて私は – AMH

2

コードを更新しました。

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
     { 
      if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) 
      { 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 80.0f, 768.0f, 40)]; 

      } 
      else 
      { 
       NSLog(@"///////////////////////////// I'm here /////////////////////"); 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 80.0f, 1024 , 40)]; 


      } 
     } 
     else 
     { 
      if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) 
      { 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40.0f, 320.0f, 40)]; 

      } 
      else 
      { 
       adView= [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 40.0f, 480 , 40)]; 


      } 

     } 
+0

ウルコードがうまく動作するが、私の更新された画像で見ることができるようにipadの風景ではない – AMH

+0

オリエンテーションを変更しているとき、それに応じてフレームを調整する必要があります。上記のコードは、初期の向きに基づいてビューを作成します。 – Apurv

+0

このビューはそのままの状態で表示されます – AMH

関連する問題