В приложениях есть файл adddelegate.h и .m.Вы добавляете iad в файл Delegate.m и создаете ссылку в другом представлении: в Appdelegate.h добавьте делегата:
@ interface AppDelegate: UIResponder
ADBannerView * bannerView;
@свойство (неатомное, сохранение) ADBannerView * bannerView;
в Appdelegate.m:
@ synthesize bannerView;
- (BOOL) приложение: (UIApplication *) приложениеdidFinishLaunchingWithOptions: (NSDictionary *) launchOptions {
bannerView = [[ADBannerView alloc] initWithFrame: CGRectZero];bannerView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifierLandscape, nil];bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;bannerView.delegate = self;
}
Теперь вы создаете ссылку на Appdelegate в другом классе viewdidload:
AppDelegate * appdelegate = (AppDelegate *) [[UIApplication sharedApplication] делегат];
UIView banner = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 480, 32)];
[banner addSubview:appdelegate.bannerView];
[self.view addSubview: banner];