1进入详情之后再返回首页,底部tabbar会消失
原因:popViewControllerAnimated:YES动画延时
处理方式:两种方式都可以
- 1 popViewControllerAnimated:NO 不要使用动画
- 2在UINavigationController类中的popViewControllerAnimated方法最上面添加如下代码:(隐藏和显示的方式保持一致)
if (self.viewControllers.count > 1) {
self.topViewController.hidesBottomBarWhenPushed = NO;
}
2 UIPageControl
圆点显示不出来,或者修改的圆点大小位置不对
如果显示不出来,就把UIPageControl的宽度增加,如果位置大小不对,之前通过遍历UIPageControl的子视图修改frame的,注意iOS 14里面UIPageControl的子视图发生了变化,新增了pageControlIndicatorContentView 和pageControlIndicatorContentView,通过遍历pageControlIndicatorContentView即可继续修改frame了
3日期控件:
iOS 13之前没有问题,iOS 13到iOS 14之间因为适配暗黑模式控件变成透明的无法显示,iOS 14以后需要适配样式和高度
修改高度:
if ([self systemVersionType] == 2) {
self.datePicker.frame = CGRectMake(0, self.Bounds.size.height - 320, ScreenWidth, 35);
}else{
self.datePicker.frame = CGRectMake(0, self.Bounds.size.height - 320, ScreenWidth, 220);
}
设置颜色
if ([self systemVersionType] == 1) {
[_datePicker setBackgroundColor:[UIColor whiteColor]];
}
//解决暗黑模式下:字体颜色显示错误的问题
if ([self systemVersionType] == 1){
//日期控件的字体颜色会自动跟随系统变化,这里需要设置他的背景颜色
[self.datePicker setValue:[UIColor blackColor] forKeyPath:@"textColor"];
//设置选中的当前日期颜色
SEL selector = NSSelectorFromString(@"setHighlightsToday:");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDatePicker instanceMethodSignatureForSelector:selector]];
BOOL no = NO;
[invocation setSelector:selector];
[invocation setArgument:&no atIndex:2];
[invocation invokeWithTarget:self.datePicker];
}
/**
根据手机系统版本进行适配
13.0之前无需特殊处理
13.0-14之前:需要适配暗黑模式
14.0以后颜色无需特殊处理,高度需要适配,样式需要适配
*/
- (int)systemVersionType
{
CGFloat version = [UIDevice currentDevice].systemVersion.floatValue;
if (version < 13.0) {
return 0;
}else if (version < 14.0){
return 1;
}else{
return 2;
}
}