Enable and Disable Touch on Multiple Elements

Home Forums iOS / tvOS Starter Kits The Story Tellers Kit 2 for iOS or tvOS Apps Enable and Disable Touch on Multiple Elements

This topic contains 5 replies, has 2 voices, and was last updated by  Scott 4 months, 3 weeks ago.

  • May 3, 2016 at 9:05 pm #148903

    I was hoping to et some help on this topic.

    I recently have come across the need to enable and disable touch on multiple elements in a .sks file.

    The basic function is that there are four keyboard inputs that will need to be disabled when a button is pressed to bring up a help/information overlay from a reference file. Once the popup is closed, the keyboards should resume being touch enabled.

    My first inclination was to use the lock and relock example from the kit demo, but I have been unsuccessful in toggle touch on and off.

    Would an array work in this case. Any help would be appreciated. Stuck on this. Thanks

  • May 3, 2016 at 9:55 pm #148915

    As a follow up to clarify, I am asking if there is another way other than replicating the lock/unlock approach.

    Thanks

    • May 4, 2016 at 9:45 am #148939

      Sure, touch priority on buttons is based on who’s on top in terms of the z position. So you could have an invisible button appear overtop the 4 buttons, thus disabling them. That button doesn’t really need to do anything, but for testing, I would at least put in a TouchEvent property of Output and make the value something like “Dummy button touched”. That way you can read in the output window in Xcode that its working.

      To activate or deactivate that button, you could change its ZDepth value back and forth, above or below the other buttons. Or you could just change its position to in-screen or off-screen.

      Let me know if that works!

  • May 6, 2016 at 8:56 am #149287

    Thanks. This makes perfect sense. I will give it a try and report back here. Is there somewhere in the documentation that references how to swap Z depth on an item.

    Appreciate the help!

  • May 6, 2016 at 9:00 pm #149419

    Thanks for the link. The first response regarding the dummy button to block touch worked perfectly. I will check out swapping Z-depth as well.

    Much appreciated

You must be logged in to reply to this topic.