- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self.dagsDatoLabel setText:NSLocalizedString(@"Dags_dato", nil)];
[self.UgenStarterLabel setText:NSLocalizedString(@"Ugen_starter", nil)];
[self.UgenSlutterDato setText:NSLocalizedString(@"Ugen_slutter", nil)];
[dato setTitle:NSLocalizedString(@"Dato", nil)];
[self loadLabels];
// 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];
// Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID before compiling.
self.adBanner.adUnitID = @"ca-app-pub-4641309369865580/1049359553";
self.adBanner.delegate = self;
self.adBanner.rootViewController = self;
[self.view addSubview:self.adBanner];
[self.adBanner loadRequest:[self request]];
}
- (void)dealloc {
_adBanner.delegate = nil;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
#pragma mark GADRequest generation
- (GADRequest *)request {
GADRequest *request = [GADRequest request];
// Make the request for a test ad. Put in an identifier for the simulator as well as any devices
// you want to receive test ads.
//request.testDevices = @[
// TODO: Add your device/simulator test identifiers here. Your device identifier is printed to
// the console when the app is launched.
// @"c229557e63bb7f5d0102a540f4fc3b7d"
// ];
return request;
}
#pragma mark GADBannerViewDelegate implementation
// We've received an ad successfully.
- (void)adViewDidReceiveAd:(GADBannerView *)adView {
NSLog(@"Received ad successfully");
}
- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);
}