You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, what's happening is that your code checks if it is landscape or portrait, then if landscape, takes the larger of the height and width as the height. If the user is in landscape, but is using split view (therefore, height is larger than width), the iAd container gets the wrong result and the container starts floating in the middle.
I'm not sure why this logic exists; it seems like, if the user is in landscape, you can simply use the height as height, right? So, I tweaked your code to remove this logic. I commented out two lines and replace them with my lines beneath them. This is the part I modified.
Let me know if there's anything wrong with it? This is in LARSAdController.m .
- (CGRect)containerFrameForInterfaceOrientation:(UIInterfaceOrientation)orientation
withPinningLocation:(LARSAdControllerPinLocation)pinningLocation {
//TODO: Modify height so that the container does not contain any whitespace above ad.
//This will enable others to add a background to the container (a la weather channel app).
CGFloat width;
CGFloat yOrigin = 0.f;
CGFloat parentWidth = CGRectGetWidth(self.parentView.frame);
CGFloat parentHeight = CGRectGetHeight(self.parentView.frame);
if (UIInterfaceOrientationIsLandscape(orientation)) {
TOLLog(@"View is landscape");
if (pinningLocation == LARSAdControllerPinLocationBottom) {
//yOrigin = MIN(parentHeight, parentWidth);
yOrigin = parentHeight;
}
//width = MAX(parentHeight, parentWidth);
width = parentWidth;
self.lastOrientationWasPortrait = NO;
}
The text was updated successfully, but these errors were encountered:
It's been several years since I wrote this logic, but if I remember correctly, it's because I was having an issue with handling rotation for all cases/platforms. I'm sure a lot of things have changed/been fixed since I wrote this particular section. 😄 Specifically, in iOS 7 or so, your application's window no longer had a transform applied to it, and the window's frame returned the correct values regardless of orientation. This was not always the case in older versions of iOS, though, which is probably what you're seeing here.
So, what's happening is that your code checks if it is landscape or portrait, then if landscape, takes the larger of the height and width as the height. If the user is in landscape, but is using split view (therefore, height is larger than width), the iAd container gets the wrong result and the container starts floating in the middle.
I'm not sure why this logic exists; it seems like, if the user is in landscape, you can simply use the height as height, right? So, I tweaked your code to remove this logic. I commented out two lines and replace them with my lines beneath them. This is the part I modified.
Let me know if there's anything wrong with it? This is in LARSAdController.m .
The text was updated successfully, but these errors were encountered: