iphone: mechanical drawing & layers
Question
I need to do a bit of mechanical drawing. I can (1) display the part’s image,
[self.view addSubview:thePartAsImageView];
(2) implement two sliders (one horizontal for part’s width and one vertical for part’s height),
heightSlider.transform = CGAffineTransformRotate(heightSlider.transform, 270.0/180*M_PI);
(3) display the corresponding values (dimensions) as the user moves the sliders, and even (4) draw the dimensioning lines with arrowheads:
CGContextAddLineToPoint
What I can’t do is (5) remove those lines after I’ve drawn them.
What I want is “if userTouchedTheHorizontalControl then eraseTheLinesForTheVerticalControl.”
If I understand correctly – first, that Quartz composites everything to a single layer, and second, that CALayer, GeekGameBoard and so on only work on Mac -- then I have to do something different. But isn’t there something I can do other than switch to Open GL?
Solution
Can you look into multitouch - on an iPhone, everyone expects to pinch or expand with two fingers to resize an image. It's the same in maps, photos, everywhere - by doing it differently your app will feel strange.
How about drawing your dimension lines on a new UIView on top of everything else with background [UIColor clearColor] and opaque=NO, then simply removing that view when the lines are no longer required?