在xcode5中添加UITabBarController或者UINavigationController出现下移20px

来源:互联网 发布:网络平台三级分销系统 编辑:程序博客网 时间:2024/05/21 17:26

问题:

我在xcode5中开发程序,系统要求为ios6以上,在ios6系统的设备上运行程序会出现下面的问题:


其中在UIViewController中添加了UITabBarController,UITabBarController每个tab中添加了一个UINavigationController,问题是UITabBarController会下移20个像素。

原因:一般UITabBarController应该添加到window上,如果添加到UIViewController中的View上,它会自动留出20px。


解决方法代码如下:

 UITabBarController *tabc=[[UITabBarControlleralloc] init];

   [tabc.view setFrame: [self.view bounds]];

红色字体为重点。


这样问题就解决了。嘿嘿~


0 0