diff --git a/.gitignore b/.gitignore index 2be37c9cf5..cbdf38071e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ DerivedData/ xcuserdata/ xcworkspace/ *.xcworkspacedata -DemoApp-ObjC/DemoApp-ObjC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +*IDEWorkspaceChecks.plist ## Other *.moved-aside diff --git a/DemoApp-ObjC/DemoApp-ObjC/ALHomeViewController.h b/DemoApp-ObjC/DemoApp-ObjC/ALHomeViewController.h index 9e2b05257e..1db057be58 100644 --- a/DemoApp-ObjC/DemoApp-ObjC/ALHomeViewController.h +++ b/DemoApp-ObjC/DemoApp-ObjC/ALHomeViewController.h @@ -8,6 +8,6 @@ #import -@interface ALHomeViewController : UIViewController +@interface ALHomeViewController : UITableViewController @end diff --git a/DemoApp-ObjC/DemoApp-ObjC/Ads/ALAutoLayoutBannerAdViewController.m b/DemoApp-ObjC/DemoApp-ObjC/Ads/ALAutoLayoutBannerAdViewController.m index ba1dfe2930..5b365d2dc2 100644 --- a/DemoApp-ObjC/DemoApp-ObjC/Ads/ALAutoLayoutBannerAdViewController.m +++ b/DemoApp-ObjC/DemoApp-ObjC/Ads/ALAutoLayoutBannerAdViewController.m @@ -21,13 +21,15 @@ - (void)viewDidLoad { [super viewDidLoad]; - self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"BANNER_AD_UNIT_ID"]; + self.adView = [[MAAdView alloc] initWithAdUnitIdentifier: @"YOUR_AD_UNIT_ID"]; self.adView.delegate = self; self.adView.translatesAutoresizingMaskIntoConstraints = NO; // Set background or background color for banners to be fully functional self.adView.backgroundColor = UIColor.blackColor; + [self.view addSubview: self.adView]; + // Center the banner and anchor it to the top of the screen. CGFloat height = (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) ? 90 : 50; // Banner height on iPhone and iPad is 50 and 90, respectively [self.view addConstraints: @[[self constraintWithAdView: self.adView andAttribute: NSLayoutAttributeLeading], @@ -40,7 +42,6 @@ - (void)viewDidLoad attribute: NSLayoutAttributeNotAnAttribute multiplier: 1.0 constant: height]]]; - [self.view addSubview: self.adView]; // Load the first ad [self.adView loadAd]; @@ -48,7 +49,7 @@ - (void)viewDidLoad - (NSLayoutConstraint *)constraintWithAdView:(MAAdView *)adView andAttribute:(NSLayoutAttribute)attribute { - return [NSLayoutConstraint constraintWithItem: self.adView + return [NSLayoutConstraint constraintWithItem: adView attribute: attribute relatedBy: NSLayoutRelationEqual toItem: self.view diff --git a/DemoApp-ObjC/DemoApp-ObjC/Supporting Files/Base.lproj/Main.storyboard b/DemoApp-ObjC/DemoApp-ObjC/Supporting Files/Base.lproj/Main.storyboard index 56265b689d..071e862269 100644 --- a/DemoApp-ObjC/DemoApp-ObjC/Supporting Files/Base.lproj/Main.storyboard +++ b/DemoApp-ObjC/DemoApp-ObjC/Supporting Files/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -13,7 +11,7 @@ - + @@ -26,11 +24,11 @@ - +