在分段控件上快速处理动作 [英] Swift handle action on segmented control

查看:63
本文介绍了在分段控件上快速处理动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有4个细分的HMSegmentedControl.选中后,它应该会弹出视图.并且当弹出窗口消失时,尝试单击相同的段索引时,它应该再次显示弹出窗口.通过使用以下命令,弹出窗口被驳回后,对同一段索引的点击没有任何作用.

I have a HMSegmentedControl with 4 segments. When it is selected, it should pop up view. And when the pop up dismissed, and trying to click on same segment index it should again show the pop up. By using following does not have any action on click of same segment index after pop up dissmissed.

segmetedControl.addTarget(self, action: "segmentedControlValueChanged:", forControlEvents: UIControlEvents.ValueChanged) 

推荐答案

您将目标设置为仅在值更改时触发,因此,如果选择同一段,则值将不会更改,并且不会显示弹出窗口,请尝试将事件更改为TouchUpInside,因此每次您在细分中触摸都会触发该事件

You set your target to fire just when the value change, so if you select the same segment the value will not change and the popover will not display, try to change the event to TouchUpInside, so it will be fired every time you touch inside the segment

segmetedControl.addTarget(self, action: "segmentedControlValueChanged:", forControlEvents:.TouchUpInside) 

这篇关于在分段控件上快速处理动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆