self.navigationController.navigationBar.translucent=YES;
UIColor *color = [UIColor clearColor];
CGRect rect = CGRectMake(0.0, 0, [UIScreen mainScreen].bounds.size.width, XCNewHeadH);
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=YES;
网友评论