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 |
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
-
identifierproperty -
centerproperty -
radiusproperty
Hit-Testing in a Region
Properties
center
The center point of the region. (read-only)
Availability
- Available in iOS 4.0 and later.
Declared In
CLRegion.hidentifier
The identifier for the region object. (read-only)
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.hradius
The radius (measured in meters) that defines the region’s outer boundary. (read-only)
Availability
- Available in iOS 4.0 and later.
Declared In
CLRegion.hInstance Methods
containsCoordinate:
Returns a Boolean value indicating whether the region contains the specified 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.hinitCircularRegionWithCenter:radius:identifier:
Initializes and returns a region object defining a circular area.
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.
Declared In
CLRegion.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-06-11)