草庐IT

UIControlEventTouchUpOutside

全部标签

ios - UIButton UIControlEventTouchUpOutside 不工作

我有一个自定义的UIButton。要在突出显示时创建自定义背景颜色,我将按钮(自身)作为三个事件的观察者:[selfaddTarget:selfaction:@selector(didTapButtonForHighlight)forControlEvents:UIControlEventTouchDown];[selfaddTarget:selfaction:@selector(didUnTapButtonForHighlight)forControlEvents:UIControlEventTouchUpInside];[selfaddTarget:selfaction:@sele

iOS:与 UIButton 的 UIControlEventTouchUpOutside 事件的行为不一致

我想从UIButton获得双重功能。当用户按下按钮时,我希望它立即触发行为A但是如果用户在释放按钮之前将他的手指拖到按钮外,我也想在释放时触发行为B。所以,[presetButtonaddTarget:selfaction:@selector(presetButtonHit:)forControlEvents:UIControlEventTouchDown];[presetButtonaddTarget:selfaction:@selector(presetButtonSwipe:)forControlEvents:UIControlEventTouchUpOutside];作为测试用