I'm completely new to objective-C and have a problem when it comes to drawing 'in real time' if one can call it that.
I programmed a simple app that reads the (x,y,z) acceleration and displays it in labels at the bottom part of the screen. I then used quartz2D to draw a rectangle (boundary) at the top part of the screen (just for presentation purposes, I don't really need it).
My next task is to draw a line, depending on the acceleration values I am reading, in the rectangle boundary I previously drew. Lets say that I get x=0.5 and y = 0.5 (ignoring z), I want to draw a line from a point, say, (100,100) to (100+x, 100+y) as soon as the x, y are read.
Is it possible to program this part, in the method that is setting the acceleration values (i.e. my MainProjectViewController.m) or do I need to make another UIView subclass?
If I need to subclass another UIView, how can I import the acceleration values (from my MainProjectViewController.m) and have the "drawRect" method in my subclass refresh every so often (if this is even possible)?
I programmed a simple app that reads the (x,y,z) acceleration and displays it in labels at the bottom part of the screen. I then used quartz2D to draw a rectangle (boundary) at the top part of the screen (just for presentation purposes, I don't really need it).
My next task is to draw a line, depending on the acceleration values I am reading, in the rectangle boundary I previously drew. Lets say that I get x=0.5 and y = 0.5 (ignoring z), I want to draw a line from a point, say, (100,100) to (100+x, 100+y) as soon as the x, y are read.
Is it possible to program this part, in the method that is setting the acceleration values (i.e. my MainProjectViewController.m) or do I need to make another UIView subclass?
If I need to subclass another UIView, how can I import the acceleration values (from my MainProjectViewController.m) and have the "drawRect" method in my subclass refresh every so often (if this is even possible)?