我的第一个屏幕(ViewController)上有一个广告横幅,我想知道在我的其他屏幕(ViewControllers)上实现广告横幅的最佳方法是什么,这样我的应用就不会因为我做错而被苹果拒绝- 我有像其中的20个。
我只是简单地将横幅从第一个屏幕复制并粘贴到其余屏幕上,还是我必须重写并添加一些代码
这是我在 .h 文件中的 AdBanner 代码
@interface ViewController : UIViewController <ADBannerViewDelegate>
@property (weak, nonatomic) IBOutlet ADBannerView *banner;
@end
这是我在 .m 文件中的 AdBanner 代码
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.banner.delegate = self;
}
- (void) viewDidLayoutSubviews {
if (self.banner.bannerLoaded) {
CGRect contentFrame = self.view.bounds;
CGRect bannerFrame = self.banner.frame;
contentFrame.size.height -= self.banner.frame.size.height;
bannerFrame.origin.y = contentFrame.size.height;
self.banner.frame = bannerFrame;
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
NSLog(@"bannerViewActionShouldBegin");
return YES;
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
NSLog(@"bannerViewDidLoadAd");
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"didFailToReceiveAdWithError");
}
- (void)bannerViewActionDidFinish:(ADBannerView *)banner {
NSLog(@"bannerViewActionDidFinish");
}
@end
非常感谢任何建议和帮助。