Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Xcode 6 iAd banner not stretch to landscape

I am creating an iOS 8 app in Xcode 6 using Swift. I have added iAds which work perfectly in portrait mode, however when I rotate the device (iPhone and iPad) the banner does not stretch to fit the view. Should I add constraints to the edges of 0?

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Tom,

Apple have a pretty extensive guide for using iAd banners within your app along with a ton of examples.

iAd Programming Guide

Hello. Is there any documentation for iAd banners in Swift?

Chris Shaw
Chris Shaw
26,676 Points

I couldn't find anything apart from a Stack Overflow thread and a pre-release page on Apple's developer site.

Thank you. I can't seem to find a fix. The problem is when I rotate my iPad it does not rotate the banner view. I am using Swift to write the app. Do you know why this could be?

Chris Shaw
Chris Shaw
26,676 Points

I'm not very familiar with iAd itself and because Swift is still so new Apple just lacks the basic documentation for it, however I was under the impression that you can use Objective-C within Swift because it compiles down to the same executable.

Okay. I will take a look. Thanks