iOS.和iOS7之间的self.view框架不一致

时间:2013-09-30 06:18:40

标签: uinavigationbar ios7 frame

在我的应用中,frame的{​​{1}}通常用于查找其子视图。但问题是self.view在iOS6和iOS7之间不一致。在storybaord中禁用了导航栏的半透明选项。使用4英寸视网膜iPhone模拟器在Xcode5中进行测试。

如何让iOS6和iOS7中的self.view.frame相同?任何帮助将不胜感激。

self.view.frame

登录iOS7:

- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }
    NSLog(@"self.view in viewDidLoad:%@",self.view);
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSLog(@"self.view in viewWillAppear:%@",self.view);
}

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    NSLog(@"self.view in viewDidAppear: %@",self.view);
}

登录iOS6:

2013-09-30 14:01:31.584 TestViewFrame[10088:a0b] self.view in viewDidLoad:<UIView: 0xa127b10; frame = (0 0; 320 568); autoresize = RM+BM; layer = <CALayer: 0xa127bb0>>
2013-09-30 14:01:31.587 TestViewFrame[10088:a0b] self.view in viewWillAppear:<UIView: 0xa127b10; frame = (0 64; 320 504); autoresize = RM+BM; layer = <CALayer: 0xa127bb0>>
2013-09-30 14:01:31.591 TestViewFrame[10088:a0b] self.view in viewDidAppear: <UIView: 0xa127b10; frame = (0 64; 320 504); autoresize = RM+BM; layer = <CALayer: 0xa127bb0>>

0 个答案:

没有答案