- (void)setNavigationBar { self.navigationController.navigationBar.translucent = YES; UIColor *color = [UIColor clearColor]; CGRect react = CGRectMake(0, 0, DEVICE_WIDTH, 64); UIGraphicsBeginImageContext(react.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, react); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [self.navigationController.navigationBar setBackgroundImage:image forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; self.navigationController.navigationBar.clipsToBounds = YES; }
网友评论