试试这个:[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];

解决方案 »

  1.   

      刚刚发错了 是这张图 ,我用的是这个方法实现的     [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"ToPointNavBg"] forBarMetrics:UIBarMetricsDefault];
    求解……
      

  2.   

    你的图片既然是透明的,那这个白色应该是self.view或者window的背景色了。
    你只能把它设置为你想要的颜色(或图片)
      

  3.   

    提供一张不透明的NavigationBar背景图
      

  4.   

    提供一张不透明的NavigationBar背景图
    似乎背景图达不到你要的效果了,因为背景图是draw在NavigationBar上的,而你要的效果是有一部分超出NavigationBar,可以尝试在NavigationBar上插入一个ImageView,sendToBack,ImageView如果被NavigationBar截断了,没有显示出那个锯齿,就设置下NavigationBar的clipToBounds
      

  5.   

    提供一张不透明的NavigationBar背景图
    似乎背景图达不到你要的效果了,因为背景图是draw在NavigationBar上的,而你要的效果是有一部分超出NavigationBar,可以尝试在NavigationBar上插入一个ImageView,sendToBack,ImageView如果被NavigationBar截断了,没有显示出那个锯齿,就设置下NavigationBar的clipToBounds 恩 哥们 这种方法虽然可以 但是顶部会覆盖掉返回按钮和titile  
      

  6.   

    提供一张不透明的NavigationBar背景图
    似乎背景图达不到你要的效果了,因为背景图是draw在NavigationBar上的,而你要的效果是有一部分超出NavigationBar,可以尝试在NavigationBar上插入一个ImageView,sendToBack,ImageView如果被NavigationBar截断了,没有显示出那个锯齿,就设置下NavigationBar的clipToBounds 恩 哥们 这种方法虽然可以 但是顶部会覆盖掉返回按钮和titile  
    我试了下,可以的,你应该没有使用sendToBack:@interface CustomNavigationBar : UINavigationBar@end@implementation CustomNavigationBar- (void)drawRect:(CGRect)rect {
        self.clipsToBounds = NO;
        
        UIImage *image = [CustomNavigationBar imageFromColor:[UIColor colorWithRed:0.3 green:0.4 blue:0.8 alpha:1]];
        UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:image];
        backgroundImageView.frame = CGRectMake(0, 0, CGRectGetWidth(rect), CGRectGetHeight(rect) + 20);
        [self addSubview:backgroundImageView];
        [self sendSubviewToBack:backgroundImageView];
    }+ (UIImage *)imageFromColor:(UIColor *)color {
        CGRect rect = CGRectMake(0, 0, 1, 1);
        UIGraphicsBeginImageContext(rect.size);
        CGContextRef context = UIGraphicsGetCurrentContext();
        CGContextSetFillColorWithColor(context, color.CGColor);
        CGContextFillRect(context, rect);
        UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return img;
    }@end@implementation UINavigationBar (GlobalBackgroundImage)+ (Class)class {
        return NSClassFromString(@"CustomNavigationBar");
    }- (void)drawRect:(CGRect)rect {
        self.clipsToBounds = NO;
    }@end如果NavigationBar是在SB里建立的,要改下Class
      

  7.   

    恩恩 谢谢 哥们 用到了你的这个方法 我总结了一下 http://bbs.csdn.net/topics/390953712 可以看下