第一个现象

addsubview添加新视图时,顶部被挡住了20 解决办法:

// 设置窗口顶部高度为20,以免被遮掩
CGRect theRect = viewController.view.frame;
theRect = CGRectOffset(theRect, 0.0, 20.0);
viewController.view.frame = theRect;

第二个现象

在UIPopoverController中添加UITabBarController,UITabBarController底部被盖住20 解决办法: 按照我的理解,是因为多了顶部状态栏(statusBar)的问题,

CGRect theRect = tabBarController.view.frame;
float statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
tabBarController.view.frame = CGRectMake(theRect.origin.x, theRect.origin.y, theRect.size.width, theRect.size.height - statusBarHeight);