随着新一代iPhone 12的发布,iOS14系统也正式开启使用。在最近的开发工作中,我发现进度条UIProgressView控件在iOS 14上面使用的控件位置会发生偏移(相对以前的iOS系统而言)。具体来说,就是进度条UIProgressView控件在iOS 14 上的左侧x坐标和高度y坐标发生偏移(相对于以前x坐标向右偏移一个像素位点,高度y坐标向下偏移了一个像素位点)。

  上代码举例以及解决办法如下:

self.loadtimeView.frame = CGRectMake(AliyunPlayerViewProgressViewLoadtimeViewLeft,AliyunPlayerViewProgressViewLoadtimeViewTop, self.bounds.size.width-2*AliyunPlayerViewProgressViewLoadtimeViewLeft, AliyunPlayerViewProgressViewLoadtimeViewHeight);

这个在iOS 14上显示的进度条效果,在iOS其他系统显示是正常的。

关于在iOS 14系统中使用UIProgressView控件出现的兼容性问题及解决办法

 

 

解决办法:

添加下面代码,对进度条UIProgressView位置进行重设
        if (@available(iOS 14, *)) {
        self.loadtimeView.frame = CGRectMake(AliyunPlayerViewProgressViewLoadtimeViewLeft+1,AliyunPlayerViewProgressViewLoadtimeViewTop-1, self.bounds.size.width-2*(AliyunPlayerViewProgressViewLoadtimeViewLeft+1), AliyunPlayerViewProgressViewLoadtimeViewHeight);
        }

   

关于在iOS 14系统中使用UIProgressView控件出现的兼容性问题及解决办法

不足之处欢迎大家提出指教,也欢迎大家转载分享,谢谢

 

相关文章:

  • 2022-12-23
  • 1970-01-01
  • 2022-12-23
  • 2021-12-04
  • 2021-12-02
  • 2022-02-15
  • 2022-12-23
猜你喜欢
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案