2013-03-30 2 views
0

모범 사례 및 화면 하단에 광고 배너를 표시하는 방법을 알고 싶습니다. 나는 phonegap 2.5를 사용하고 있으며 화면 상단에 표시 할 수 있습니다. 이것이 내가 adBannerView를 만드는 방법입니다.iOS iAd 배너 배치

- (void)webViewDidFinishLoad:(UIWebView*)theWebView 
{ 
    // Black base color for background matches the native apps 
    theWebView.backgroundColor = [UIColor blackColor]; 

    adView = [[[ADBannerView alloc] initWithFrame:CGRectZero] autorelease]; 
    //adView.frame = CGRectMake(0, 410, 320, 50); // if you want the banner to be on top of the screen remove this line 
    adView.delegate = self; 
    adView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 
    [theWebView addSubview:adView]; 

    return [super webViewDidFinishLoad:theWebView]; 
} 

아이폰 (4,5)이 다른 해상도를 가지고 있기 때문에 위의 주석 처리 된 줄을 기준으로 위치를 수정하고 싶은지 잘 모르겠습니다. 화면 맨 아래에 어떻게 놓을 수 있는지 알려주세요.

감사합니다.

나는이 link에 무엇을 시도했다, 그러나 나는 충돌 제약

답변

1

이 시도에 대한 오류!

adView = [[ADBannerView alloc] initWithFrame:CGRectZero]; 
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait]; 
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait; 
CGRect adFrame = adView.frame; 
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height; 
adView.frame = adFrame; 
[theWebView addSubview:adView]; 
+0

작동하지 않았습니다. –

+0

마지막으로 xib 파일에 배너를 추가하고 해당 속성을 콘센트로 사용했습니다. 어쨌든 인물 모드에서 작동하고 하단에서 작동 할 수 없습니다. 하지만 지금은 나에게 충분하다. –