导航栏遮盖视图解决办法

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    // 方法一
    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }
    // 方法二
    self.edgesForExtendedLayout =UIRectEdgeNone;
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    // 方法三
    self.edgesForExtendedLayout =UIRectEdgeNone;
    self.extendedLayoutIncludesOpaqueBars = YES;
    // 方法四
    if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0)) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
        self.extendedLayoutIncludesOpaqueBars = NO;
        self.modalPresentationCapturesStatusBarAppearance = NO;
    }

//方法五
    ViewController *vc = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    //tabBar跳转后不隐藏也可导致顶部被遮挡
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];

你可能感兴趣的:(导航栏遮盖视图解决办法)