// 导航栏和图片无缝兼容
self.navigationController.navigationBar.translucent = YES;
UIColor *color = [UIColor clearColor];
CGRect rect = CGRectMake(0.f, 0.f, self.view.frame.size.width, 64.f);
// 画图获取一个透明图片设给导航栏
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.clipsToBounds = NO;
// 把导航栏底部黑线去掉
self.navigationController.navigationBar.translucent = YES;
UIColor *color = [UIColor clearColor];
CGRect rect = CGRectMake(0.f, 0.f, self.view.frame.size.width, 64.f);
// 画图获取一个透明图片设给导航栏
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.clipsToBounds = NO;
// 把导航栏底部黑线去掉
self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];