iOS Developer Library — Pre-Release

Developer

UIKit Framework Reference UICoordinateSpace Protocol Reference

Options
Deployment Target:

On This Page
Language:

UICoordinateSpace

The UICoordinateSpace protocol defines methods for converting between different frames of reference on a screen. The UIView and UIScreen classes adopt this protocol so that you can convert easily between most coordinate spaces in your app. The UIScreen class also provides coordinate space with a fixed frame of reference for tasks that require it. You can adopt this protocol in your own classes to convert between your custom coordinate spaces and the coordinate spaces of your app’s views and screens. More...

Inheritance


Not Applicable

Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 8.0 and later.
  • bounds bounds Property

    The bounds rectangle describing the item’s location and size in its own coordinate system. (required) (read-only)

    Declaration

    Swift

    var bounds: CGRect { get }

    Objective-C

    @property(readonly, nonatomic) CGRect bounds

    Discussion

    The rectangle in this property always matches the app’s interface orientation. For apps that support all interface orientations, the value in this property can change when the user rotates the device between portrait and landscape modes.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • Converts a point from the coordinate space of the current object to the specified coordinate space. (required)

    Declaration

    Swift

    func convertPoint(_ point: CGPoint, toCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGPoint

    Objective-C

    - (CGPoint)convertPoint:(CGPoint)point toCoordinateSpace:(id<UICoordinateSpace>)coordinateSpace

    Parameters

    point

    A point specified in the coordinate system of the current object.

    coordinateSpace

    The coordinate space into which point is to be converted.

    Return Value

    A point specified in the target coordinate space.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • Converts a point from the specified coordinate space to the coordinate space of the current object. (required)

    Declaration

    Swift

    func convertPoint(_ point: CGPoint, fromCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGPoint

    Objective-C

    - (CGPoint)convertPoint:(CGPoint)point fromCoordinateSpace:(id<UICoordinateSpace>)coordinateSpace

    Parameters

    point

    A point in the specified coordinate space.

    coordinateSpace

    The coordinate space in which point is specified.

    Return Value

    A point specified in the coordinate space of the current object.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • Converts a rectangle from the coordinate space of the current object to the specified coordinate space. (required)

    Declaration

    Swift

    func convertRect(_ rect: CGRect, toCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGRect

    Objective-C

    - (CGRect)convertRect:(CGRect)rect toCoordinateSpace:(id<UICoordinateSpace>)coordinateSpace

    Parameters

    rect

    A rectangle specified in the coordinate system of the current object.

    coordinateSpace

    The coordinate space into which rect is to be converted.

    Return Value

    A rectangle specified in the target coordinate space.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.

  • Converts a rectangle from the specified coordinate space to the coordinate space of the current object. (required)

    Declaration

    Swift

    func convertRect(_ rect: CGRect, fromCoordinateSpace coordinateSpace: UICoordinateSpace) -> CGRect

    Objective-C

    - (CGRect)convertRect:(CGRect)rect fromCoordinateSpace:(id<UICoordinateSpace>)coordinateSpace

    Parameters

    rect

    A rectangle in the specified coordinate space.

    coordinateSpace

    The coordinate space in which rect is specified.

    Return Value

    A rectangle specified in the coordinate space of the current object.

    Import Statement

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.