IOS7 edgesForExtendedLayout

在iOS 7中,苹果引入了一个新的属性,叫做[UIViewController setEdgesForExtendedLayout:],它的默认值为UIRectEdgeAll。当你的容器是navigation controller时,默认的布局将从navigation bar的顶部开始。这就是为什么所有的UI元素都往上漂移了44pt。有时会加上顶部tool bar的高度 20, 20+44 = 64

解决办法
- (void)viewDidLoad  
{  
    [super viewDidLoad];  
    // Do any additional setup after loading the view.  
    if (OSVersionIsAtLeastiOS7()) {  
        if ([self respondsToSelector:@selector(edgesForExtendedLayout)])  
        {  
            self.edgesForExtendedLayout = UIRectEdgeNone;  
        }  
    }  

原文地址:https://www.cnblogs.com/jingdizhiwa/p/6168756.html