2013-03-06 4 views
0

Google의 지침에 따라 kobold2d v2.1.0을 사용하고 AdMob 조정 SDK를 프로젝트에 추가했습니다.AdView를 탭하면 CCMenuItem가 응답합니다.

AdViewController을 작성하여 rootViewController.view에 추가했습니다.

AdViewController.m :

-(void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // Initialize the banner at the bottom of the screen. 
    CGPoint origin = CGPointMake(0.0, 
        self.view.frame.size.height - 
        CGSizeFromGADAdSize(kGADAdSizeBanner).height); 

    // Use predefined GADAdSize constants to define the GADBannerView. 
    self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner 
               origin:origin]; 

    // before compiling. 
    self.adBanner.adUnitID = AD_UNIT_ID; 
    self.adBanner.delegate = self; 
    [self.adBanner setRootViewController:self]; 
    [self.view addSubview:self.adBanner]; 
    self.adBanner.center = 
    CGPointMake(self.view.center.x, self.adBanner.center.y); 
    [self.adBanner loadRequest:[self createRequest]]; 
} 

AppDelegete.m

-(void) initializationComplete 
{ 
    adViewController = [[AdViewController alloc] init]; 
    [self.rootViewController.view addSubview:adViewController.view]; 
} 

-(id) alternateView 
{ 
    // we want to be a dummy view the self.view to which we add the glView plus all other UIKit views 
    KKAppDelegate* appDelegate = (KKAppDelegate*)[UIApplication sharedApplication].delegate; 

    // add a dummy UIView to the view controller, which in turn will have the glView and later other UIKit views added to it 
    CGRect bounds = [appDelegate.window bounds]; 
    UIView* dummyView = [[UIView alloc] initWithFrame:bounds]; 

    [dummyView addSubview:[CCDirector sharedDirector].view]; 

    return dummyView; 
} 

광고가 원격으로 나는 CCMenuItem을 누릅니다 것처럼 CCMenuItem을 누르면 위치, 표시되기 전에 나는 광고 영역을 누릅니다

.

나는이 this question에 관한 생각이

image

보면,하지만 난 그것을 해결하는 방법을 알고하지 마십시오.

CCMenuItem이 원격 위치의 탭에 응답하는 것을 방지하는 방법을 알려주십시오.

영어가 능숙하지 않아서 죄송합니다.

답변

0

CCMenu.m에서 - (CCMenuItem *) itemForTouch :(UITouch *) touch 메서드를 변경하여 문제를 해결했습니다.

-(CCMenuItem *) itemForTouch: (UITouch *) touch 
{ 
    //CGPoint touchLocation = [touch locationInView: [touch view]]; 
    /*changed*/ CGPoint touchLocation = [touch locationInView: [CCDirector sharedDirector].view]; 
    touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation]; 

    ....... 

} 

변경하기 전에 [터치보기]는 AdView이므로 CCMenu의 좌표가 잘못되었습니다.

나는 this question을 참조하고있었습니다.