Contents

session(_:didChangeViewRotationAngle:)

This is called when the view rotation angle changes.

Declaration

optional func session(_ session: ARSession, didChangeViewRotationAngle viewRotationAngle: CGFloat)

Parameters

  • session:

    The session that provides the angle.

  • viewRotationAngle:

    The angle, in degrees, normalized to [0, 360) (0 at LandscapeRight, 90 at Portrait, 180 at LandscapeLeft, and 270 at PortraitUpsideDown).

Discussion

ARKit calls this method when a new angle becomes available, in step with the system UI rotation. Implement it to rotate a view by the given angle so the ARFrame it displays stays level with the horizon as the device rotates.