1

I have a CCLabelTTF on a CCNodeColor that will scroll across the screen. My problem is that it looks perfect on iPad Mini,iPhone 4,5,6 and completely wrong on iPhone6+,iPad Air, iPad Retina. I've changed the contentSizeType and nothing changed. The current font size is 15.0f, but if I lower it to 5.0f it will work correctly(but it would be too small). Something also odd is that if I change the font to 25.0f it wont work on any device. I don't know contentSize before hand because its based on the length of the NSString. Can this all be done in SpriteBuilder? I am using SpriteBuilder for other aspect of the app. I am using the lastest Cocos2d version. Below are the images and code:

self.tickerOne = [CCNodeColor nodeWithColor:[CCColor redColor]];
self.tickerTwo = [CCNodeColor nodeWithColor:[CCColor redColor]];

self.dataSourceArray = [self.dataSource setDataSourceArray];

NSString *stockTickerString = [self.dataSourceArray componentsJoinedByString:@" |  "];

self.tickerOne.positionType = CCPositionTypeNormalized;
self.tickerOne.anchorPoint = ccp(0.5f,0.0f);
self.tickerOne.name = @"tickerOne";

CCLabelTTF *tickerLabel = [CCLabelTTF labelWithString:stockTickerString fontName:@"ArialMT" fontSize:**15.0f**];
tickerLabel.positionType = CCPositionTypeNormalized;
tickerLabel.anchorPoint = ccp(0.5f,0.5f);
tickerLabel.position = ccp(0.5f,0.5f);
tickerLabel.name = @"tickerLabel1";


self.contentSizeType = CCSizeTypePoints;
self.contentSize = CGSizeMake(tickerLabel.contentSize.width*1.5,tickerLabel.contentSize.height*2);
self.tickerOne.contentSize = self.contentSize;

[self addChild:self.tickerOne];
[self.tickerOne addChild:tickerLabel z:10];

This is something I noticed in Debugging area. I'm totally lost with this stuff

OpenGL error GL_INVALID_VALUE detected at __28-[CCTexture setAntialiased:]_block_invoke 428
OpenGL error GL_INVALID_VALUE detected at -[CCGraphicsBufferGLUnsynchronized commit] 179

Image: iPad Retina label font size 15.0f enter image description here

Image: iPhone 6 label font size 15.0f enter image description here

Image: iPhone 6 label font size 25.0f enter image description here

4

0 回答 0