I want to draw a vertical line where the screen was used. Since the middle finger is more than 1 pixel wide, I want to do this "step by step". So basically, a line can only be displayed every 25 pixels. And I want to find out the nearest place where I could draw a line.
For example, if my finger displays 30 pixels on the left side of my top view, I want to draw a vertical line of 25 pixels on the left side of the view. If the screen displays 40 pixels on the left, I want the line to draw 50 pixels on the left side. (Thus, there can only be one line every 25 pixels, and I want to draw the closest.
Any idea how I could do this?
Line drawing is easy:
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(100.0, 0.0, 1, 320.0)]; lineView.backgroundColor = [UIColor whiteColor]; [parentView addSubview:lineView];
But I do not know how to find where the user tapped on the screen.
source share