ios 获取导航栏、状态栏的高度

   //状态栏

    CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];

     NSLog(@"status width %f ---- status height %f",rectStatus.size.width, rectStatus.size.height);

    //导航栏

    CGRect rectNav = self.navigationController.navigationBar.frame;

     NSLog(@"nav width %f ---- nav height %f",rectNav.size.width, rectNav.size.height);

   

//打印结果:

2017-09-21 11:26:01.493 appName[3778:833899] status width 375.000000 ---- status height 20.000000

2017-09-21 11:26:01.493 appName[3778:833899] nav width 375.000000 ---- nav height 44.000000


你可能感兴趣的:(iOS)