這裏是我的iAd的代碼和我得到約iOS 6或成癮者給予太多警告
setRequiredContentSizeIdentifiers - deprecated in iOS 6
ADBannerContentSizeIdentifier320x50 - deprecated in iOS 4.2
ADBannerContentSizeIdentifier480x32 - deprecated in iOS 4.2
setCurrentContentSizeIdentifier - deprecated in iOS 6
ADBannerContentSizeIdentifier480x32 - deprecated in iOS 4.2
我怎麼解決這個問題,所以沒有警告的警告。
- (int)getBannerHeight:(UIDeviceOrientation)orientation
{
if (UIInterfaceOrientationIsLandscape(orientation)) {
return 32;
} else {
return 50;
}
}
- (int)getBannerHeight
{
return [self getBannerHeight:[UIDevice currentDevice].orientation];
}
- (void)createAdBannerView
{
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if (classAdBannerView != nil) {
self->adView = [[classAdBannerView alloc]
initWithFrame:CGRectZero];
[adView setRequiredContentSizeIdentifiers:[NSSet setWithObjects:
ADBannerContentSizeIdentifier320x50,
ADBannerContentSizeIdentifier480x32, nil]];
if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
[adView setCurrentContentSizeIdentifier:
ADBannerContentSizeIdentifier480x32];
} else {
[adView setCurrentContentSizeIdentifier:
ADBannerContentSizeIdentifier320x50];
}
[adView setFrame:CGRectOffset([adView frame], 0,
-[self getBannerHeight])];
[adView setDelegate:self];
[self.view addSubview:adView];
}
}
- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation
{
if (adView != nil) {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
[adView setCurrentContentSizeIdentifier:
ADBannerContentSizeIdentifier480x32];
} else {
[adView setCurrentContentSizeIdentifier:
ADBannerContentSizeIdentifier320x50];
}
[UIView beginAnimations:@"fixupViews" context:nil];
if (bannerIsVisible) {
CGRect adBannerViewFrame = [adView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = 0;
[adView setFrame:adBannerViewFrame];
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y =
[self getBannerHeight:toInterfaceOrientation];
contentViewFrame.size.height = self.view.frame.size.height -
[self getBannerHeight:toInterfaceOrientation];
_contentView.frame = contentViewFrame;
} else {
CGRect adBannerViewFrame = [adView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y =
-[self getBannerHeight:toInterfaceOrientation];
[adView setFrame:adBannerViewFrame];
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = 0;
contentViewFrame.size.height = self.view.frame.size.height;
_contentView.frame = contentViewFrame;
}
[UIView commitAnimations];
}
}
從iOS 6起,ADBannerContentSizeIdentifierPortrait也被棄用 –
請參閱編輯... – Macmade
該死的。這總是一些東西。瞭解任何好的地方(除了Apple的模糊文檔以瞭解關於自動調整功能的信息) –