使用SwiftCharts时处理旋转

时间:2018-03-19 19:07:05

标签: swiftcharts

我正在使用SwiftCharts for Swift 4.我无法弄清楚如何正确显示简单的图形,无论是横向启动应用程序,还是处理从纵向到横向的旋转。有人能指出我如何处理非肖像实现的示例或文档吗?

提前致谢

1 个答案:

答案 0 :(得分:0)

在RangedAxisExample中找到了这个。

let orientation = UIApplication.shared.statusBarOrientation
    guard (lastOrientation.map{$0.rawValue != orientation.rawValue} ?? true) else {return}

    lastOrientation = orientation

    guard let chart = chart else {return}
    for view in chart.view.subviews {
        view.removeFromSuperview()
    }
    self.drawChart() //  my chart code here

    chart.view.setNeedsDisplay()