iOS Developer Library

Developer

QuartzCore Framework Reference CAScrollLayer Class Reference

Options
Deployment Target:

On This Page
Language:

CAScrollLayer

The CAScrollLayer class is a subclass of CALayer that simplifies displaying a portion of a layer. The extent of the scrollable area of the CAScrollLayer is defined by the layout of its sublayers. The visible portion of the layer content is set by specifying the origin as a point or a rectangular area of the contents to be displayed. CAScrollLayer does not provide keyboard or mouse event-handling, nor does it provide visible scrollers.

Inheritance


Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in iOS 2.0 and later.
  • Defines the axes in which the layer may be scrolled.

    Declaration

    Swift

    var scrollMode: String!

    Objective-C

    @property(copy) NSString *scrollMode

    Discussion

    The possible values are described in “Scroll Modes”. The default is kCAScrollBoth.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later.

  • Changes the origin of the receiver to the specified point.

    Declaration

    Swift

    func scrollToPoint(_ thePoint: CGPoint)

    Objective-C

    - (void)scrollToPoint:(CGPoint)thePoint

    Parameters

    thePoint

    The new origin.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later.

  • Scroll the contents of the receiver to ensure that the rectangle is visible.

    Declaration

    Swift

    func scrollToRect(_ theRect: CGRect)

    Objective-C

    - (void)scrollToRect:(CGRect)theRect

    Parameters

    theRect

    The rectangle that should be visible.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later.

  • These constants describe the supported scroll modes used by the scrollMode property.

    Declaration

    Swift

    let kCAScrollNone: NSString! let kCAScrollVertically: NSString! let kCAScrollHorizontally: NSString! let kCAScrollBoth: NSString!

    Objective-C

    NSString * const kCAScrollNone; NSString * const kCAScrollVertically; NSString * const kCAScrollHorizontally; NSString * const kCAScrollBoth;

    Constants

    • kCAScrollNone

      kCAScrollNone

      The receiver is unable to scroll.

      Available in iOS 2.0 and later.

    • kCAScrollVertically

      kCAScrollVertically

      The receiver is able to scroll vertically.

      Available in iOS 2.0 and later.

    • kCAScrollHorizontally

      kCAScrollHorizontally

      The receiver is able to scroll horizontally.

      Available in iOS 2.0 and later.

    • kCAScrollBoth

      kCAScrollBoth

      The receiver is able to scroll both horizontally and vertically.

      Available in iOS 2.0 and later.