Reputation: 4115
Im creating a custom control which consist of two layers in a donut shape. The middle is a button, while the donut part is a rotation wheel.
I have created the two parts as two individual UIControls with there own seperate images.
My problem right now is that the Second Control
is overriding my First Control
.
Is there a programmatically way to overlap the positions?
Storyboard screenshot:
Please focus on the particular view called buttonView
. Rotary knob
is the donut and Button
is the middle button.
Thanks in advance.
Upvotes: 0
Views: 735
Reputation: 33421
I assume your donut part is bigger than your middle part, right? If so I think you should be able to use the hitTest:WithEvent: function to distinguish the two. Your middle section needs to be below your outer section in the hierarchy though. hitTest will return the deepest view in the hierarchy that was touched.
EDIT As per the extended comments, the problem was that they were reversed in the XIB. Switch them around and your mid-section will appear on top.
Upvotes: 1
Reputation: 25740
In the view that contains them both, just call [self bringSubviewToFront:firstLayer]
.
Upvotes: 0