ios7下出现的问题及解决

来源:互联网 发布:vr制作app软件 编辑:程序博客网 时间:2024/05/22 17:08

装了xcode5,体验了一把ios7,整个界面也是冲着扁平化的方向,怎么说呢,简约而不简单。另外ios7模拟器不是一个iphone而是一个页面,因为是高分辨率屏幕,所以大了。可以用command+1,command+2,command+3来调屏幕大小。
总之就是更好用了。

将以前写的一些app放Xcode5下编译,不少问题出来了。


首先就是界面上的状态栏了,iOS7貌似默认程序就是全屏(fullscreen)模式,用半透明的方法将状态栏挡在后面,感觉有点怪怪的,比如:

在iOS7之前,我们可以这样干:[[UIApplication sharedApplication] setStatusBarHidden:YES];

但是现在无效了,需要在app的plist文件中,添加两个属性:UIStatusBarHidden和UIViewControllerBasedStatusBarAppearance,顾名思义,就是用来设置状态栏的,如图所示:

好像用一个属性就有效果了。


20140610隐藏状态栏的改正:在plist中添加Status bar is initially hidden和View controller-based status bar appearance;第一个设置为YES,第二个设置为NO


第二个出现的问题就是CCLabel有些内容无法显示,

这个需要通过改源码,

修改CCImage.mm的

static bool _initWithString(constchar * pText, cocos2d::CCImage::ETextAlign eAlign,const char * pFontName,intnSize, tImageInfo* pInfo)



        const int _width  = dim.width;  //Add
        const int _height = dim.height;  //Add
        
        unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)];
        memset(data, 0, (int)(_width * _height * 4));   //Modify
        
        // draw text
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();    
        CGContextRef context = CGBitmapContextCreate(data, _width, _height, 8, _width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
        CGColorSpaceRelease(colorSpace);                //Modify
        
        if (! context)
        {
            delete[] data;
            break;
        }