Using Accelerometer Data

This application will use the accelerometer data to offset the center of drawing in the HypnosisView. So, HypnosisView needs two properties to define the offset. In HypnosisView.h, add these properties.

@​i​n​t​e​r​f​a​c​e​ ​H​y​p​n​o​s​i​s​V​i​e​w​ ​:​ ​U​I​V​i​e​w​
{​
 ​ ​ ​ ​f​l​o​a​t​ ​x​S​h​i​f​t​,​ ​y​S​h​i​f​t​;​
}​
@​p​r​o​p​e​r​t​y​ ​(​n​o​n​a​t​o​m​i​c​,​ ​a​s​s​i​g​n​)​ ​f​l​o​a​t​ ​x​S​h​i​f​t​;​
@​p​r​o​p​e​r​t​y​ ​(​n​o​n​a​t​o​m​i​c​,​ ​a​s​s​i​g​n​)​ ​f​l​o​a​t​ ​y​S​h​i​f​t​;​
@​e​n​d​

Now synthesize these properties in HypnosisView.m:

@​i​m​p​l​e​m​e​n​t​a​t​i​o​n​ ​H​y​p​n​o​s​i​s​V​i​e​w​
@​s​y​n​t​h​e​s​i​z​e​ ​x​S​h​i​f​t​,​ ​y​S​h​i​f​t​;​

HypnosisView needs to know how to use these properties ...

Get iOS Programming: The Big Nerd Ranch Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.