开发者

UIButton Custom Highlight

The app I am currently developing uses draggable UIButtons created programmatically. They work very well: after creating them, I add a UIPanGestureRecognizer which enables me to track their position as they are dragged.

I also have added a different background for their UIControlStateHighlighted. However, I would like more than just a different background i开发者_StackOverflow中文版mage: I would like the button to grow to a larger size when it is first touched. This behavior should look a little like what happens when one presses a letter on the keyboard.

I have tried to change its size in the touchesBegan of the UIPanGestureRecognizer object, but it does not respond when first touched: only when the user starts dragging.

Thank you in advance for your help


Move Me is a sample project provided by Apple which demonstrates how to track an object with gestures and touches, and also has code which changes the size of the object. It is done with a UIView, but the code should be easily portable to a UIButton. Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜