2011-11-12 2 views
1

보기와 탐색 모음이있는 내비게이션 컨트롤러가 있습니다. Navbar와보기 사이에 AdView (AdWhirl을 사용하고 있습니다)를 삽입하고 싶습니다. AdView가 아래로 내려 가서보기를 아래로 밀어야합니다 (보기가 화면 크기가 아닌 화면 크기로 조정되어야 함).광고를 수신 할 때 AdView를 아래로 내림

이 문제는 Three20과 협력하고 있습니다.

아이디어가 있으십니까?

감사합니다.

답변

3

저는 Three20에 너무 익숙하지 않지만 어떻게하면 정상적으로 할 수 있는지 말할 수 있습니다. adWhirlDidReceiveAd:에이 코드를 작성하고 싶습니다. 올바른 대리자를 설정하고 해당 메소드를 재정의하는 방법에 대한 자습서를 읽고 광고보기가 내비게이션 컨트롤러의 현재보기의 하위보기라고 가정합니다.

따라서 adWhirlDidReceiveAd:에서 내비게이션 컨트롤러에있는 콘텐츠 인 콘텐츠를 아래로 내리고받은 광고에서 슬라이드합니다.

- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView_ { 


    CGSize adSize = [adWhirlView_ actualAdSize]; 
    CGRect newFrame = adWhirlView_.frame; 

    newFrame.size = adSize; 
    newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2; 

    //Draw offscreen so that it can slide in properly 
    CGRect tempFrame = newFrame; 
    tempFrame.origin.y = -newFrame.size.height; 
    adWhirlView_.frame = tempFrame; 

    [UIView animateWithDuration:1.0 animations:^{ 
     //Access frame of view controller in nav controller 
     CGRect viewFrame = [self.navigationController topViewController].view.frame; 

     // Decrease the height of the view by the height of the adwhirlView 
     viewFrame.size.height = [self.navigationController topViewController].view.frame.size.height - 
         adwhirlView_.frame.size.height; 
     // Shift view down to make room for the ad 
     viewFrame.origin.y = adwhirlView_.frame.size.height; 

     [self.navigationController topViewController].view.frame = viewFrame; 

     //Slide down the ad 
     adwhirlView_.frame = frame; 

    }]; 

} 
당신은 아마 당신이 슬라이드 전환에게 광고에 나오는 모든 시간을하지 않도록 첫 번째 광고는 이미뿐만 아니라 올 경우 검사 할

.

난 당신이 청소 수있는 확신 내가 할 수있는 동안 나는 내 생각을 많이 내리고 싶다.

+0

합법적 인 것 같습니다 ^^ 시도해보십시오 :) –