From 1695287d84f37a71aaf2d75b17360cfd4c11f13e Mon Sep 17 00:00:00 2001 From: finscn Date: Fri, 7 Mar 2014 14:14:26 +0800 Subject: [PATCH 1/2] fix the size of iAd banner in iPad under landscape there is a bug: in landscape iPad (test on iOS 6.13), the iAd banner's width is always 768px . and in new iOS , the apple suggest to use sizeThatFits , so I pull this request. --- Source/Ejecta/EJUtils/EJBindingAdBanner.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Ejecta/EJUtils/EJBindingAdBanner.m b/Source/Ejecta/EJUtils/EJBindingAdBanner.m index 0d5c9ca7..37ffa5cd 100644 --- a/Source/Ejecta/EJUtils/EJBindingAdBanner.m +++ b/Source/Ejecta/EJUtils/EJBindingAdBanner.m @@ -22,7 +22,14 @@ - (void)createWithJSObject:(JSObjectRef)obj scriptView:(EJJavaScriptView *)view ? ADBannerContentSizeIdentifierLandscape : ADBannerContentSizeIdentifierPortrait), nil]; - + // for iOS 6 + banner.currentContentSizeIdentifier = (landscape + ? ADBannerContentSizeIdentifierLandscape + : ADBannerContentSizeIdentifierPortrait); + // for iOS 6 later + CGSize adSize = [banner sizeThatFits:scriptView.bounds.size]; + [banner setFrame:CGRectMake(0, 0, adSize.width, adSize.height);]; + [scriptView addSubview:banner]; NSLog(@"AdBanner: init at y %f", banner.frame.origin.y); } From f4d72c4d682a648a4f5b435ed6219f8d8a5c4085 Mon Sep 17 00:00:00 2001 From: finscn Date: Fri, 7 Mar 2014 15:37:09 +0800 Subject: [PATCH 2/2] Update EJBindingAdBanner.m --- Source/Ejecta/EJUtils/EJBindingAdBanner.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Ejecta/EJUtils/EJBindingAdBanner.m b/Source/Ejecta/EJUtils/EJBindingAdBanner.m index 37ffa5cd..c28a0a99 100644 --- a/Source/Ejecta/EJUtils/EJBindingAdBanner.m +++ b/Source/Ejecta/EJUtils/EJBindingAdBanner.m @@ -28,7 +28,7 @@ - (void)createWithJSObject:(JSObjectRef)obj scriptView:(EJJavaScriptView *)view : ADBannerContentSizeIdentifierPortrait); // for iOS 6 later CGSize adSize = [banner sizeThatFits:scriptView.bounds.size]; - [banner setFrame:CGRectMake(0, 0, adSize.width, adSize.height);]; + [banner setFrame:CGRectMake(0, 0, adSize.width, adSize.height)]; [scriptView addSubview:banner]; NSLog(@"AdBanner: init at y %f", banner.frame.origin.y);