CLRegion Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/CoreLocation.framework
Availability
Available in iOS 4.0 and later.
Companion guide
Declared in
CLRegion.h
Related sample code

Overview

The CLRegion class defines a geographical area that can be tracked. When an instance of this class is registered with a CLLocationManager object, the location manager generates an appropriate event whenever the user crosses the boundaries of the defined area.

To use this class, create an instance of it and use the startMonitoringForRegion:desiredAccuracy: method of a CLLocationManager object to begin monitoring it.

Tasks

Initializing a Circular Region

Accessing a Region’s Attributes

Hit-Testing in a Region

Properties

center

The center point of the region. (read-only)

@property(readonly, nonatomic) CLLocationCoordinate2D center
Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CLRegion.h

identifier

The identifier for the region object. (read-only)

@property(readonly, nonatomic) NSString *identifier
Discussion

This is a value that you specify and can use to identify this region inside your application.

Availability
  • Available in iOS 4.0 and later.
Declared In
CLRegion.h

radius

The radius (measured in meters) that defines the region’s outer boundary. (read-only)

@property(readonly, nonatomic) CLLocationDistance radius
Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CLRegion.h

Instance Methods

containsCoordinate:

Returns a Boolean value indicating whether the region contains the specified coordinate.

- (BOOL)containsCoordinate:(CLLocationCoordinate2D)coordinate
Parameters
coordinate

The coordinate to test against the region.

Return Value

YES if the coordinate lies within the region’s boundaries or NO if it does not.

Availability
  • Available in iOS 4.0 and later.
Declared In
CLRegion.h

initCircularRegionWithCenter:radius:identifier:

Initializes and returns a region object defining a circular area.

- (id)initCircularRegionWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius identifier:(NSString *)identifier
Parameters
center

The center point of the region.

radius

The distance (measured in meters) from the center point that marks the boundary of the region.

identifier

A unique identifier to associate with the region object. You use this identifier to differentiate regions within your application. This value must not be nil.

Return Value

An initialized region object.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
CLRegion.h

Did this document help you? Yes It's good, but... Not helpful...