How do I disable the navigation bar shadow in iOS 6 for navigation bars with custom background images?

前端 未结 13 1527
后悔当初
后悔当初 2020-12-12 17:10

It seems in iOS 6, a drop shadow is automatically added to the navigation bar even when you set a custom background image. I\'m pretty sure this wasn\'t the case with iOS 5

13条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 17:48

    I had the same problem and I've solved it by following:

    CustomNavBar *navBar = (CustomNavBar *)self.navigationController.navigationBar;
            [navBar setBackgroundImage:[UIImage imageNamed:@"navigation_bar_gray.png"] forBarMetrics:UIBarMetricsDefault];
            navBar.shadowImage = [[UIImage alloc]init]; // this is what acctually removed the shadow under navigation bar 
    

提交回复
热议问题