iAd减少FPS? [英] iAd reducing FPS?
问题描述
iAd横幅会减少FPS吗?
Does iAd banner reduces FPS?
事实上,自从我加入iAd以来,我是59的所有游戏,现在它的变量从35-50 FPS。
Indeed, since I added iAd my FSP is shit. I was 59 all game and now it's variable from 35-50 FPS.
任何想法,因为我的游戏几乎无法与这个横幅可播放。
Any ideas please because my game is almost not playable with this banner.
感谢帮助。
推荐答案
您应该在 UINavigationController
在 appDelegate
中设置的子类。在矿井代码它看起来像:
You should implement the iAd logic in your UINavigationController
subclass that was set in the appDelegate
. At mine code it look like:
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Create the main window
window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
CCGLView *glView = [CCGLView viewWithFrame:[window_ bounds]
pixelFormat:kEAGLColorFormatRGB565
depthFormat:0
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];
// Enable multiple touches
[glView setMultipleTouchEnabled:YES];
director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
director_.wantsFullScreenLayout = YES;
// Display FSP and SPF
[director_ setDisplayStats:YES];
// set FPS at 60
[director_ setAnimationInterval:1.0/60];
//FEW LINES LATER
// Create a Navigation Controller with the Director
navController_ = [[MyNavigationController alloc] initWithRootViewController:director_];
navController_.navigationBarHidden = YES;
[self checkDeviceType];
// setup iAds bannerView
[self setupIADs];
// for rotation and other messages
[director_ setDelegate:navController_];
// set the Navigation Controller as the root view controller
[window_ setRootViewController:navController_];
// make main window visible
[window_ makeKeyAndVisible];
return YES;
}
- (void)setupIADs {
CGSize size = [[CCDirector sharedDirector] winSize];
float bannerHeight = _isiPadRunning ? 66.0f : 50.0f;
ADAdType bannerType = _isiPadRunning ? ADAdTypeMediumRectangle : ADAdTypeBanner;
_bannerView = [[ADBannerView alloc] initWithAdType:bannerType];
_bannerView.frame = CGRectMake(0, navController_.view.frame.size.height, size.width, bannerHeight);
CGSize newBannerSize = [_bannerView sizeThatFits:CGSizeMake(size.width, bannerHeight)];
_bannerView.frame = CGRectMake(0, navController_.view.frame.size.height,
newBannerSize.width, newBannerSize.height);
_bannerView.delegate = self;
//get view
UIView *mainView = [navController_ view];
[mainView addSubview:_bannerView];
[mainView setNeedsLayout];
}
正如你所看到的,我使用 navController _
以放置iAd横幅视图。没有FPS下降! :)
请试试看。对我来说,它有帮助,我没有FPS滴或延迟。一切都很棒。
As you can see I use navController_
to place an iAd banner view. No FPS drops! :)
Please, try it out. For me it helped and I have no FPS drops or delay. Everything works great.
这篇关于iAd减少FPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!