Xcode 9/ Swift 4: Prevent UIButton from continuing to be highlighted, when you press it and drag the finger outside of its boundstouchesBegin & touchesMove Xcode Obj C QuestionUIButton events. What's the difference?How can you switch from using one UIButton to another while still holding down finger?Using UIControlEventTouchDragEnter to trigger a button's method… but doesn't work?Triggering a UIButton's method when user drags finger into button's area?Trigger an action on UIButton touch inside dragged outside and then release fingerStop the UIButton being 'active' when finger is dragged outside its boundsUnwanted Invisible detection area around UIButton when HighlightedChanging UIButton borderColor in sync with title when highlightingHighlight continues when touch outside of button in swift

Why does the trade federation become so alarmed upon learning the ambassadors are Jedi Knights?

Are local nested functions possible in elisp?

wavelength of seismic wave with a gaussian source

Can I play a first turn Simic Growth Chamber to have 3 mana available in the second turn?

How to convert 1k to 1000 and 1m to 1000000 in Excel

Back to the nineties!

Should you avoid redundant information after dialogue?

Bob's unnecessary trip to the shops

latinate or other words of foreign origin as opposed to Germanic words

Is purchasing foreign currency before going abroad a losing proposition?

How can I deal with a player trying to insert real-world mythology into my homebrew setting?

Why limit to revolvers?

What is temperature on a quantum level?

Is this floating-point optimization allowed?

Can a continent naturally split into two distant parts within a week?

Help with understanding nuances of extremely popular Kyoto-ben (?) tweet

Why the term 'unified' in "unified mass unit"?

The monorail explodes before I can get on it

What is a printer console?

How many matrices satisfy this equality?

Why is dry soil hydrophobic? Bad gardener paradox

Why did the Japanese attack the Aleutians at the same time as Midway?

If the derivative of a function is square of it then it is constant

Metric version of "footage"?



Xcode 9/ Swift 4: Prevent UIButton from continuing to be highlighted, when you press it and drag the finger outside of its bounds


touchesBegin & touchesMove Xcode Obj C QuestionUIButton events. What's the difference?How can you switch from using one UIButton to another while still holding down finger?Using UIControlEventTouchDragEnter to trigger a button's method… but doesn't work?Triggering a UIButton's method when user drags finger into button's area?Trigger an action on UIButton touch inside dragged outside and then release fingerStop the UIButton being 'active' when finger is dragged outside its boundsUnwanted Invisible detection area around UIButton when HighlightedChanging UIButton borderColor in sync with title when highlightingHighlight continues when touch outside of button in swift






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-2















When you press a UIButton, if you keep holding it while dragging your finger outside of its bounds, there's a certain distance that you can move you finger until the button's state is not "highlighted" anymore.



Essentially, you can press a button, move your finger outside of it, release it, and the button will still fire, even though your finger wasn't on it when it was released.



Is there any way to prevent this behavior? I want buttons to be "released" as soon as you're outside of them.










share|improve this question
























  • What button action have you added to the UIButton ?

    – Amit
    Mar 26 at 5:44











  • You can bind Action UIControlEventTouchDragOutside of button and change the behavior whatever you want.

    – Vishal Patel
    Mar 26 at 5:44

















-2















When you press a UIButton, if you keep holding it while dragging your finger outside of its bounds, there's a certain distance that you can move you finger until the button's state is not "highlighted" anymore.



Essentially, you can press a button, move your finger outside of it, release it, and the button will still fire, even though your finger wasn't on it when it was released.



Is there any way to prevent this behavior? I want buttons to be "released" as soon as you're outside of them.










share|improve this question
























  • What button action have you added to the UIButton ?

    – Amit
    Mar 26 at 5:44











  • You can bind Action UIControlEventTouchDragOutside of button and change the behavior whatever you want.

    – Vishal Patel
    Mar 26 at 5:44













-2












-2








-2








When you press a UIButton, if you keep holding it while dragging your finger outside of its bounds, there's a certain distance that you can move you finger until the button's state is not "highlighted" anymore.



Essentially, you can press a button, move your finger outside of it, release it, and the button will still fire, even though your finger wasn't on it when it was released.



Is there any way to prevent this behavior? I want buttons to be "released" as soon as you're outside of them.










share|improve this question
















When you press a UIButton, if you keep holding it while dragging your finger outside of its bounds, there's a certain distance that you can move you finger until the button's state is not "highlighted" anymore.



Essentially, you can press a button, move your finger outside of it, release it, and the button will still fire, even though your finger wasn't on it when it was released.



Is there any way to prevent this behavior? I want buttons to be "released" as soon as you're outside of them.







swift xcode uibutton swift4 xcode9






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 5:44







Alex K

















asked Mar 26 at 5:41









Alex KAlex K

2591 gold badge2 silver badges12 bronze badges




2591 gold badge2 silver badges12 bronze badges












  • What button action have you added to the UIButton ?

    – Amit
    Mar 26 at 5:44











  • You can bind Action UIControlEventTouchDragOutside of button and change the behavior whatever you want.

    – Vishal Patel
    Mar 26 at 5:44

















  • What button action have you added to the UIButton ?

    – Amit
    Mar 26 at 5:44











  • You can bind Action UIControlEventTouchDragOutside of button and change the behavior whatever you want.

    – Vishal Patel
    Mar 26 at 5:44
















What button action have you added to the UIButton ?

– Amit
Mar 26 at 5:44





What button action have you added to the UIButton ?

– Amit
Mar 26 at 5:44













You can bind Action UIControlEventTouchDragOutside of button and change the behavior whatever you want.

– Vishal Patel
Mar 26 at 5:44





You can bind Action UIControlEventTouchDragOutside of button and change the behavior whatever you want.

– Vishal Patel
Mar 26 at 5:44












1 Answer
1






active

oldest

votes


















1














The UIControlEvent you are looking for is UIControlEventTouchUpInside - It works when touch is inside of the bound.



For more details check this URL:



  • https://developer.apple.com/documentation/uikit/uicontrolevents


  • https://developer.apple.com/documentation/uikit/uicontrolevents/uicontroleventtouchupinside?language=objc






share|improve this answer























  • How exactly would I go about disabling this event for all buttons in the application?

    – Alex K
    Mar 26 at 5:59











  • By default Control Events are disabled for the buttons. You have to add control event which you need.

    – Amit
    Mar 26 at 6:07










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55350513%2fxcode-9-swift-4-prevent-uibutton-from-continuing-to-be-highlighted-when-you-p%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The UIControlEvent you are looking for is UIControlEventTouchUpInside - It works when touch is inside of the bound.



For more details check this URL:



  • https://developer.apple.com/documentation/uikit/uicontrolevents


  • https://developer.apple.com/documentation/uikit/uicontrolevents/uicontroleventtouchupinside?language=objc






share|improve this answer























  • How exactly would I go about disabling this event for all buttons in the application?

    – Alex K
    Mar 26 at 5:59











  • By default Control Events are disabled for the buttons. You have to add control event which you need.

    – Amit
    Mar 26 at 6:07















1














The UIControlEvent you are looking for is UIControlEventTouchUpInside - It works when touch is inside of the bound.



For more details check this URL:



  • https://developer.apple.com/documentation/uikit/uicontrolevents


  • https://developer.apple.com/documentation/uikit/uicontrolevents/uicontroleventtouchupinside?language=objc






share|improve this answer























  • How exactly would I go about disabling this event for all buttons in the application?

    – Alex K
    Mar 26 at 5:59











  • By default Control Events are disabled for the buttons. You have to add control event which you need.

    – Amit
    Mar 26 at 6:07













1












1








1







The UIControlEvent you are looking for is UIControlEventTouchUpInside - It works when touch is inside of the bound.



For more details check this URL:



  • https://developer.apple.com/documentation/uikit/uicontrolevents


  • https://developer.apple.com/documentation/uikit/uicontrolevents/uicontroleventtouchupinside?language=objc






share|improve this answer













The UIControlEvent you are looking for is UIControlEventTouchUpInside - It works when touch is inside of the bound.



For more details check this URL:



  • https://developer.apple.com/documentation/uikit/uicontrolevents


  • https://developer.apple.com/documentation/uikit/uicontrolevents/uicontroleventtouchupinside?language=objc







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 5:49









AmitAmit

2,5932 gold badges17 silver badges33 bronze badges




2,5932 gold badges17 silver badges33 bronze badges












  • How exactly would I go about disabling this event for all buttons in the application?

    – Alex K
    Mar 26 at 5:59











  • By default Control Events are disabled for the buttons. You have to add control event which you need.

    – Amit
    Mar 26 at 6:07

















  • How exactly would I go about disabling this event for all buttons in the application?

    – Alex K
    Mar 26 at 5:59











  • By default Control Events are disabled for the buttons. You have to add control event which you need.

    – Amit
    Mar 26 at 6:07
















How exactly would I go about disabling this event for all buttons in the application?

– Alex K
Mar 26 at 5:59





How exactly would I go about disabling this event for all buttons in the application?

– Alex K
Mar 26 at 5:59













By default Control Events are disabled for the buttons. You have to add control event which you need.

– Amit
Mar 26 at 6:07





By default Control Events are disabled for the buttons. You have to add control event which you need.

– Amit
Mar 26 at 6:07








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55350513%2fxcode-9-swift-4-prevent-uibutton-from-continuing-to-be-highlighted-when-you-p%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript