Monday, 30 September 2013

How to drop a button over another in iOS

How to drop a button over another in iOS

I have two UIButtons in a ViewController. One of them is dragable using
UIPanGesture recogniser. I want to drop this dragable UIButton over a
fixed UIButton. How can I achieve this?
This is what I tried:
if (CGRectIntersectsRect(self.firstButton.frame, self.oneButton.frame))
{
[self.oneButton addSubview:self.firstButton]; //first button is the
dragable button.
}
However I figured just adding as subview won't work. What is the right way
to achieve this?

No comments:

Post a Comment