How do I make a side-scroller-like view
I have a UIImageView in a nib with a static image as a background. I want the user to keep one finger down in another view, and move it around to change a height setting.
The other view overlaps the image view with the same height but a narrow width. The image view should have a line drawn to a point with a constant width, but the height should depend on the location of touch in the other view. I have attached an illustration, in case my wording is not clear. The grey, transparent view to the right of the center of the picture is the view where the user holds down, and the background is the image view with the lines as part of the image.
I want the new line to always draw to the same x value, but a variable y value in the image view, and I want the former lines to shift to the left, kind of like in a side scroller game, but the foreground will change, not the background.
I will update the image view's drawing very frequently, so that the resulting drawing over the image view will be a smooth curve keeping track of all of the former heights.
Do I use a CGMutablePath, and add more linesToPoint to that path every update frequency milli-seconds, shift the path to the left, then redraw the path? I don't know how to do this, so could someone help me out.
Thanks.
|