iOS开发-iOS 14遇到的问题 适配

作者: dl_wj15 | 来源:发表于2020-10-10 13:55 被阅读0次

相信很多小伙伴们都已经更新xcode12和iOS 14了,不知道你们有没有遇到和我一样的问题呢。话不多说,直接看下问题。

问题1:由页面A->B->C,然后由C直接返回A,底部的tabbar不显示

解决方法重写方法:popToRootViewControllerAnimated:

- (NSArray<__kindof UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
    if (self.viewControllers.count > 0) {
        UIViewController *popController = self.viewControllers.lastObject;
        popController.hidesBottomBarWhenPushed = NO;
    }
    return [super popToRootViewControllerAnimated:animated];
}

问题2:在iPhone11上状态栏高度由 44->48多了4pt

以前的宏定义导航栏高度需要重新定义

/**
 *状态栏高度
 */
#define StatusBarHeight  [[UIApplication sharedApplication] statusBarFrame].size.height
/**
 *导航栏高度
 */
#define NavigationBarHeight (StatusBarHeight + 44)

问题3:YYKit中的YYAnimatedImageView加载图片的类在iOS14中不能显示普通类型图片

解决方法需要找到该类并修改该类中的displayLayer:方法

- (void)displayLayer:(CALayer *)layer {
    if (_curFrame) {
        layer.contents = (__bridge id)_curFrame.CGImage;
    } else {
        if (@available(iOS 14.0, *)) {
            [super displayLayer:layer];
        }
    }
}

问题4:iOS14中UICollectionview的scrollToItemAtIndexPath:atScrollPosition:animated:水平方向滑动失效

该问题我是在SDCycleScrollView这个第三方库中发现其不能正常定时滚动

if (@available(iOS 14.0, *)) {
        UICollectionViewLayoutAttributes *attributes = [_flowLayout layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0]];
        [_collectionView setContentOffset:attributes.frame.origin animated:YES];
    } else {
        [_collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:targetIndex inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:YES];
    }

以上是当前我已经发现并且解决了的问题,若小伙伴们还有问题发现请留言给我。

相关文章

网友评论

    本文标题:iOS开发-iOS 14遇到的问题 适配

    本文链接:https://www.haomeiwen.com/subject/ojadpktx.html