Reputation: 25
How to add UIButtons
, UILabels
UIImageView
on CALayer
and perform actions according to the button pressed.Thanks in advance
{
[graphic addSublayer:self.firstButton.layer];
[graphic addSublayer:self.mylabel.layer];
[self.view.layer addSublayer:graphic];
}
I used the above code but when I pressed the button it does not perform any action Thanks
Upvotes: 2
Views: 2907
Reputation: 2067
A CALayer is not an event responder, If you want a button that actually works on top of a CALayer, put that CALayer into a UIView and add a UIButton to that view.
Upvotes: 1