LiveSight
LiveSight enables user experiences that use the real world as an interface. With LiveSight, developers can overlay geospatial content on the real world which is displayed using the device camera. Additionally, an immersive experience is created by using the device sensors to track movement in space and update the view accordingly.
The key concepts covered in this section include adding LiveSight to an iOS application, starting LiveSight in Camera Mode, and customizing the LiveSight experience. The classes covered include NMACompositeView
and NMAARController
.
LiveSight requires iOS users to grant your application access to the back camera. If the camera is not available, NMAARErrorCameraAccessNotAuthorized
error code is returned when starting LiveSight.
NMACompositeView
The UIView
subclass related to LiveSight functionality is the NMACompositeView
. NMACompositeView
exposes LiveSight functionality in one iOS UI component. For the remainder of this section we use NMACompositeView
in code samples and discussions.
NMACompositeView
does not support a map view. As such, the composite view only supports LiveSight, and it is rendered as a black screen until LiveSight is started. Support for using the map view along with the camera view will be added to NMACompositeView
in a future release. Adding and Initializing the NMACompositeView
The first step to integrate LiveSight functionality into an application is to insert an NMACompositeView
into the view layout. This is accomplished by adding NMACompositeView
subview to the current iOS view.
As with other UIView
objects, the NMACompositeView
must be initialized by calling initWithFrame:
method. During this asynchronous initialization the NMAARController
is also created. More information about NMAARController
can be found in Customizing LiveSight.
Starting and Stopping LiveSight
To control LiveSight, two methods from NMAARController
, start
and stopWithAnimation:
, are used. You can call start
method after creating the composite view to trigger the LiveSight Mode. Calling start
while already in LiveSight Mode results in NMAARErrorInvalidOperation
error code being returned. Use stopWithAnimation:
method to stop LiveSight.
