UIButton not receiving touches when superview has a zposition

521 Views Asked by At

I have a view which has three buttons. If i set the zPosition of the view to bring it on top the buttons placed on it do not receive touches.

However as soon as leave the zPosition of the view to the default the buttons start to receive touches. I have checked all the usual suspects bringToFront etc and nothing is working.

What is wrong here is there some significant gap in my understanding.

self.dropDownMenu.layer.shadowColor = [UIColor blackColor].CGColor;
self.dropDownMenu.layer.shadowOffset = CGSizeMake(0.0, -3.0);
self.dropDownMenu.layer.shadowOpacity = 0.5;
self.dropDownMenu.layer.shadowRadius = 4.0;
self.dropDownMenu.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.dropDownMenu.bounds].CGPath;
self.dropDownMenu.layer.zPosition = 20.0;
[self.dropDownMenu bringSubviewToFront:self.breakfastBtn];
0

There are 0 best solutions below