We revisit the Hello Location - Location Updatesexample
from Chapter 3, Using Location in your iOS Apps Core Location, and add the heading component to our application. Here is what we will achieve: Our application will check for heading information, and as we move the device left/right, we will adjust the on-screen slider to reflect the change in the direction.
1. We begin with defining a
UISlider
object in our app in theHello_LocationViewController.h
file, and expose it as a property.@property (strong, nonatomic) IBOutlet UISlider *XSlider;
2. We also declare three additional properties of type
UITextField
that will hold theX, Y
, andZ
values retrieved from the magnetometer. Of this, our interest lies in theX
value. We will use this to move the slider, as we move right /left.@property (strong, nonatomic) IBOutlet UITextField *XVALUE; @property (strong, nonatomic) IBOutlet UITextField *YVALUE; @property (strong, nonatomic)...