【问题标题】:How to return to the current scene when iAd is clicked点击 iAd 时如何返回当前场景
【发布时间】:2023-04-10 14:10:01
【问题描述】:

我已经完成了 sprite-Kit 游戏的所有代码,但 iAd 给了我很多困难。当点击 iAd 时,游戏会再次重新启动。如何解决这个问题?我有 viewController ,标题场景,levelOne 场景,二级场景的游戏。我阅读了其他相关帖子,但无法解决问题。谢谢你。

viewController.h

#import <iAd/iAd.h>

@interface RAViewController
@property (nonatomic, strong) ADBannerView *adView;
@end

viewController.m

-(void)viewDidLoad{

    ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    [adView setFrame:CGRectMake(0, 0, 1024, 768)]; // set to your screen dimensions
    [adView setBackgroundColor:[UIColor clearColor]];
    [self.view addSubview:adView];
}

【问题讨论】:

    标签: ios7 sprite-kit iad


    【解决方案1】:
    adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    adView.delegate = self;
    [adView setFrame:CGRectMake(0, 0, 1024, 768)]; // set to your screen dimensions
    [adView setBackgroundColor:[UIColor clearColor]];
    [self.view addSubview:adView];
    

    也许委托可以帮助你。这段代码我没试过,试试看告诉我行不行。

    【讨论】:

    • 当我添加 adView.delegate = self; ,它显示错误“Assigning to 'id' from in compatible type 'viewController *const_strong
    • 我在游戏中心委托上有同样的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-26
    • 1970-01-01
    相关资源
    最近更新 更多