diff --git a/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/Main.storyboard b/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/Main.storyboard index 7823dc00..e16394c7 100644 --- a/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/Main.storyboard +++ b/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/Main.storyboard @@ -1,9 +1,10 @@ - + - + + @@ -35,122 +36,112 @@ - + - - + + - - - - - - - - - - - + + - - - + + + + - + - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + + + + - - - - - + + + + @@ -167,12 +158,12 @@ - + - - - - + + + + @@ -184,5 +175,8 @@ + + + diff --git a/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/NativeAdView.xib b/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/NativeAdView.xib index 95748299..1841a532 100644 --- a/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/NativeAdView.xib +++ b/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/Base.lproj/NativeAdView.xib @@ -1,85 +1,93 @@ - + - - + + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/ViewController.m b/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/ViewController.m index da213871..3dedd478 100644 --- a/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/ViewController.m +++ b/Objective-C/admob/NativeAdvancedExample/NativeAdvancedExample/ViewController.m @@ -32,9 +32,6 @@ @interface ViewController () 0) { - self.heightConstraint = + if (nativeAdView.mediaView != nil && nativeAd.mediaContent.aspectRatio > 0) { + NSLayoutConstraint *aspectRatioConstraint = [NSLayoutConstraint constraintWithItem:nativeAdView.mediaView - attribute:NSLayoutAttributeHeight + attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nativeAdView.mediaView - attribute:NSLayoutAttributeWidth - multiplier:(1 / nativeAd.mediaContent.aspectRatio) + attribute:NSLayoutAttributeHeight + multiplier:(nativeAd.mediaContent.aspectRatio) constant:0]; - self.heightConstraint.active = YES; + [nativeAdView.mediaView addConstraint:aspectRatioConstraint]; + [nativeAdView layoutIfNeeded]; } if (nativeAd.mediaContent.hasVideoContent) {