The object is to implement a semi-transparent layer which would slid out to collect user response when needed. The semi-transparent layer would have some icons on it for the user to choose from. Currently I am using a CALayer object which seems ok and it has some build in animation behavior.
But the problem is CALayer does not response to any touch events at all. Now I am thinking that I should be using a UIView instead. UIView inherits from UIResponder, so its objects are naturally capable of responding to users’ events.
It’s a decision between UIView and CALayer. For the CALayer, I have done quite a bit of work on it and it looks quite ok except about the touch response that has to be added. Or should I use a UIView as subview instead (since it has build-in touch respond) ?
Hope that somebody knowledgable on this could help …
In order to respond to user interaction, the best way is to use a
UIView. You could probably get it to work without one, but I wouldn’t recommend it.As for integrating your existing layer with the
UIView, I’d create a subclass ofUIViewand override its+layerClassmethod to return theClassof your customCALayer. Alternatively, if you’re not using a customCALayersubclass (and there generally isn’t a real need to create your own), you can do your custom drawing inside theUIView‘s-drawLayer:inContext:method.