0

画面の下部にaddviewを表示したいのですが、アプリはユニバーサルなので、このコードをviewdidloadで使用します

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の幅をうまく埋められないことです

ここに画像の説明を入力 よろしくお願いし ます

4

2 に答える 2

1

コードがそのifブロック内にあるため、そこにある配置コードはすべてiPad用であるため、iPhoneではまったく機能しません。

そして、幅を埋めることについては、何が表示されているかを言っていないので。

于 2012-02-28T16:37:31.810 に答える