-
Notifications
You must be signed in to change notification settings - Fork 673
Open
Description
- (void)lt_setBackgroundColor:(UIColor *)backgroundColor
{
if (!self.overlay) {
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
//适配iPhoneX
CGFloat navigationBarHeight = 0;
if ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) {
navigationBarHeight = 44.0f+self.frame.size.height;
}else{
navigationBarHeight = 20.f+self.frame.size.height;
}
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds),navigationBarHeight)];
self.overlay.userInteractionEnabled = NO;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[[self.subviews firstObject] insertSubview:self.overlay atIndex:0];
}
self.overlay.backgroundColor = backgroundColor;
}
Metadata
Metadata
Assignees
Labels
No labels