[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forBarMetrics:UIBarMetricsCompact];
self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
[self.navigationController.navigationBar setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
for (id view in self.navigationController.navigationBar.subviews)
{
if ([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")])
{
for (id i in [view subviews])
{
if ([i isKindOfClass:[UIImageView class]])
{
[i removeFromSuperview];
}
}
}
}
[[[[self.navigationController.navigationBar.subviews firstObject] subviews] firstObject] removeFromSuperview];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"More" style:UIBarButtonItemStyleDone target:self action:@selector(more)];
北京--疯子
+ (UIImage *)imageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0, 0, 1, 1);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
原文:http://www.cnblogs.com/linxiu-0925/p/5224882.html