UIButton 与 iPhone 中的触摸动画互换?
我在视图中有 5X5 按钮。 基于某些条件,我想互换它们。 我如何知道其中哪一个被触摸,如果无法移动则一条消息 将显示警报。如果可以移动,则当前按钮应替换 上一篇。
提前致谢...
I have 5X5 button in a view.
Based on some Condition, i want to interchange them.
How can i know which of them is touched, if move is not possible then a message
alert will be displayed.If the move is possible then current button should replace the
Previous one.
Thanks in Advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议你检查一下你的问题,因为很难理解你真正想要什么。但要知道内部哪个按钮被触摸,您可以为按钮分配唯一的标签,然后检查发件人的标签。或者另一种方式,声明 25 个 UIButton IBOutlet(实例变量)并将它们连接到 Interface Builder 中的按钮。然后你可以检查[sender isEqual:button1(button2 etc....)]。
或者
I suggest you review your question as it is difficult to understand what you really want. But to know which button was touched up inside you can assign unique tags to buttons and then check for the sender's tag. Or another way, declare 25 UIButton IBOutlets (instance variables) and connect them to the buttons in Interface Builder. And then you can check if the [sender isEqual:button1(button2 etc....)].
or
单击按钮后,如果您可以检索按钮的标题,您可以使用以下代码(如果您的按钮触摸事件连接到此功能):-
After clicking the button if you can retreive the title of the button you can use the follwing code(if your button touch down event is connected to this function):-