2.0.4 CCLabelTTF在ios7下不显示的问题(转)

来源:互联网 发布:淘宝大学披肩老师 编辑:程序博客网 时间:2024/05/16 01:41

转自:http://www.cnblogs.com/JD85/p/3368497.html

要修改框架lib目录里的 CCImage.mm,就是把浮点值取了个整,之前的浮点形导致绘制失败:

在_initWithString这个方法里把如下代码替换一下就行了:

///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// // for CCLabelTTF can not show text in ios7 /* unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)]; memset(data, 0, (int)(dim.width * dim.height * 4)); // draw text CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(data, dim.width, dim.height, 8, dim.width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); */ const int _width = dim.width; const int _height = dim.height; unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)]; memset(data, 0, (int)(_width * _height * 4)); // draw text CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(data, _width, _height, 8, _width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); ///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////


阅读全文
0 0
原创粉丝点击