I am working on an app, which actually works like MSPaint (something to draw lines, etc…).
I got a white UIView, basically where the user draws. On top of this UIView I set up a UIImage, which is gray, with a 0,4 alpha. I want this UIImage to be used as a blotting paper. The idea is to disable touch when the user put the palm of his hand on this area, so it’s more comfortable to draw (multitouch is disabled, and with this “blotting paper” you won’t draw something accidentally with your palm…)
Even if I bring the UIImage to the front, on top of the view, and even if I disable user interactions on this UIImage, it is still possible to draw on the UIView. , behind the UIImage (kind of strange!)
I do not understand what’s happening, because, it seems that the image is transparent, and that the UIView “behind” is still active, even if she’s overlaid by the UIImage?!
Any help/indication/idea would be much appreciated! Thank you 🙂
OK, so I managed to do what I wanted to! YAY!
I got 3 different classes :
StrokesViewController (UIViewController)-the view controller
StrokesView (UIView) – the view where the user draws the strokes.
BlottingPaper (UIView) – the blotting paper.
I got a XIB file “linked” to all three.
I created this new class, called “BlottingPaper”, typed UIView. the .h and .m file are actually empty (I do import #import < Foundation/Foundation.h >)
User interaction is enable on BlottingPaper.
I do not use the exclusive touch on this class.
On the XIB file, I just put a view on top of StrokesView. I link it to BlottingPaper (modify the alpha as I want, blablabla…)
And that’s it! When I put the palm of my hand on it, it doesn’t draw anything on the area where my hand is, but I still can draw with my finger on the rest of the StrokesView!